<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"><head profile="http://gmpg.org/xfn/11">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>
	Using Doctrine 2 in Zend Framework 2 | The Blog of Jason Grimes	</title>
		<link rel="stylesheet" type="text/css" media="all" href="Using_Doctrine_2_files/style.css">
	<link rel="pingback" href="http://www.jasongrimes.org/xmlrpc.php">
	<link rel="alternate" type="application/rss+xml" title="The Blog of Jason Grimes » Feed" href="http://www.jasongrimes.org/feed/">
<link rel="alternate" type="application/rss+xml" title="The Blog of Jason Grimes » Comments Feed" href="http://www.jasongrimes.org/comments/feed/">
<link rel="alternate" type="application/rss+xml" title="The Blog of Jason Grimes » Using Doctrine 2 in Zend Framework 2 Comments Feed" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/feed/">
<link rel="stylesheet" id="lightbox-css" href="Using_Doctrine_2_files/lightbox.css" type="text/css" media="all">
<link rel="stylesheet" id="thickbox-css" href="Using_Doctrine_2_files/thickbox.css" type="text/css" media="all">
<link rel="stylesheet" id="galleria-css" href="Using_Doctrine_2_files/galleria.css" type="text/css" media="all">
<link rel="stylesheet" id="slickr-flickr-css" href="Using_Doctrine_2_files/slickr-flickr.css" type="text/css" media="all">
<script src="Using_Doctrine_2_files/ga.js" async="" type="text/javascript"></script><script type="text/javascript" src="Using_Doctrine_2_files/jquery_002.js"></script>
<script type="text/javascript" src="Using_Doctrine_2_files/comment-reply.js"></script>
<script type="text/javascript" src="Using_Doctrine_2_files/external-tracking.js"></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.jasongrimes.org/xmlrpc.php?rsd">
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.jasongrimes.org/wp-includes/wlwmanifest.xml"> 
<link rel="prev" title="Using Apache Ivy to manage directory dependencies in non-Java projects" href="http://www.jasongrimes.org/2012/01/using-apache-ivy-to-manage-directory-dependencies-in-non-java-projects/">
<link rel="next" title="Managing LAMP environments with Chef, Vagrant, and EC2 (1 of 3)" href="http://www.jasongrimes.org/2012/06/managing-lamp-environments-with-chef-vagrant-and-ec2-1-of-3/">
<meta name="generator" content="WordPress 3.4">
<link rel="canonical" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/">
<link rel="shortlink" href="http://www.jasongrimes.org/?p=324">
<link href="Using_Doctrine_2_files/shCore.css" type="text/css" rel="stylesheet"><link href="Using_Doctrine_2_files/shThemeDefault.css" type="text/css" rel="stylesheet"><meta id="syntaxhighlighteranchor" name="syntaxhighlighter-version" content="3.1.3">
<!-- Google Analytics Tracking by Google Analyticator 6.2: http://ronaldheft.com/code/analyticator/ -->
<script type="text/javascript">
	var analyticsFileTypes = [''];
	var analyticsEventTracking = 'enabled';
</script>
<script type="text/javascript">
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-24288408-1']);
	_gaq.push(['_trackPageview']);
	_gaq.push(['_trackPageLoadTime']);

	(function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	})();
</script>
</head>
<body class="single single-post postid-324 single-format-standard">
<div id="nav">
	<div id="menus">
		<ul><li><a href="http://www.jasongrimes.org/">Home</a></li></ul>
		<ul><li class="page_item page-item-2"><a href="http://www.jasongrimes.org/about/">About</a></li>
<li class="page_item page-item-83"><a href="http://www.jasongrimes.org/contact/">Contact</a></li>
</ul>	</div>
	<div id="search">
		<form id="searchform" method="get" action="http://www.jasongrimes.org/">
<input value="Search: type, hit enter" onfocus="if (this.value == 'Search: type, hit enter') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search: type, hit enter';}" size="35" maxlength="50" name="s" id="s" type="text">
<input id="searchsubmit" value="SEARCH" type="submit">
</form>	</div>
</div>
<div id="wrapper">
	<div id="header">		<h1><a href="http://www.jasongrimes.org/">The Blog of Jason Grimes</a></h1>
		<h2>Web development, systems, and other things that interest me.</h2>
		<div class="clear"></div>
			</div>
<div id="content">
		<div class="post-324 post type-post status-publish format-standard hentry category-development tag-composer tag-doctrine2 tag-php tag-zf2 post-single" id="post-324"><!-- post div -->
		<h2 class="title">Using Doctrine 2 in Zend Framework 2</h2>
		<div class="post-info-top">
			<span class="post-info-date">
				Posted by <a href="http://www.jasongrimes.org/author/jg/" title="View all posts by Jason" rel="author">Jason</a>
				on				January 29, 2012							</span>
						<span class="addcomment"><a href="#respond" rel="nofollow" title="Leave a comment ?">Leave a comment</a> (172)</span>
			<span class="gotocomments"><a href="#comments" rel="nofollow" title="Go to comments ?">Go to comments</a></span>
					</div>
		<div class="clear"></div>
		<div class="entry">
			<p><a style="color: #4a630f; text-decoration: none;" href="http://www.jasongrimes.org/wp-content/uploads/2012/01/doctrine-zf2.png"><img class="alignleft size-full wp-image-325" style="border-style: initial; border-color: initial; border-width: initial;" title="doctrine-zf2" src="Using_Doctrine_2_files/doctrine-zf2.png" alt="" height="130" width="301"></a></p>
<div>
<p>Zend Framework 2 is getting close to release, and among the changes 
are new ways to handle dependency injection, and new ways to work with 
third-party code as modules. Rob “Akrabat” Allen has updated his iconic <a href="http://akrabat.com/getting-started-with-zend-framework-2/">Getting Started with Zend Framework</a> tutorial for ZF2, and it’s a great place to start. </p>
<p>After working through that tutorial, the next thing I wanted to do was figure out how to get the Doctrine 2 ORM up and running.</p>
<p>This article shows how to set up and use Doctrine 2 in Zend Framework
 2, by extending Rob’s Getting Started tutorial to use Doctrine instead 
of Zend_Db.</p>
<p><em>Updated 18 June 2012: Added support for new Doctrine config file format.</em><br>
<em>Updated 2 June 2012: Added support for ZF2 beta 4 and the new composer-based installation methods.</em></p>
</div>
<p><span id="more-324"></span></p>
<p></p><div class="toc"><div class="toc_list"><ul><li class="toc_item"><a href="#toc-start-with-akrabats-tutorial">Start with Akrabat’s tutorial</a></li><li class="toc_item"><a href="#toc-install-doctrine-modules">Install Doctrine modules</a></li><li class="toc_item"><a href="#toc-create-the-album-entity">Create the Album entity</a></li><li class="toc_item"><a href="#toc-update-the-album-controller-to-use-doctrine-instead-of-zend_db">Update the Album controller to use Doctrine instead of Zend_Db</a></li><li class="toc_item"><a href="#toc-thats-it">That’s it!</a></li></ul></div></div> <p></p>
<h2>Start with Akrabat’s tutorial</h2>
<div>
<p>The examples here build on the sample album tracker application created in Rob Allen’s <em>Getting Started with Zend Framework 2</em> tutorial. You can <a href="http://akrabat.com/getting-started-with-zend-framework-2/">get the tutorial here</a>. You can also <a href="https://github.com/akrabat/zf2-tutorial">download the code from Github</a>. (Thanks, Akrabat!)</p>
<p>In the examples below, I’ll use the environment variable $PROJECT_DIR
 to refer to the base directory of the ZF2 tutorial. To make things 
easy, set that variable to the correct value for your environment. For 
example:</p>
</div>
<div></div>
<pre>PROJECT_DIR=~/zf2-tutorial</pre>
<h2>Install Doctrine modules<a name="toc-install-doctrine-modules" style="text-decoration: none;">&nbsp;&nbsp;</a></h2>
<p>Doctrine can be integrated into Zend Framework 2 as a “module” which 
provides all the libraries and configuration in a self-contained bundle.
 Installing these Doctrine modules is pretty straightforward. We’ll use 
Composer to install them into the project directory, and then tweak a 
couple configuration files.</p>
<p>For this example, we need the <a href="https://github.com/doctrine/DoctrineModule">DoctrineModule</a>, which provides common code for different Doctrine providers, and the <a href="https://github.com/doctrine/DoctrineORMModule">DoctrineORMModule</a>,
 a “provider” module which includes all the Doctrine2 libraries for the 
ORM. (For those using MongoDB, there’s also a separate ODM provider 
module.) See the <a href="https://github.com/doctrine/DoctrineORMModule">README file for the DoctrineORMModule</a> for further details about the installation process.</p>
<h3>Install Doctrine with composer</h3>
<p>Edit the <strong>$PROJECT_DIR/composer.json</strong> file, and add the following to the “require” element:</p>
<pre>    "require": {
        ...,
        "doctrine/DoctrineORMModule": "dev-master"
    },
</pre>
<p>Then run <code>php composer.phar update</code> to install the modules.</p>
<h3>Configure Doctrine</h3>
<p>Edit <strong>$PROJECT_DIR/config/application.config.php</strong> and add <strong>DoctrineModule</strong>&nbsp;and <strong>DoctrineORMModule</strong> to the list of modules–in that order, and <em>before</em> the Album module. Like this:</p>
<div><div id="highlighter_208143" class="syntaxhighlighter  php"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="php string">'modules'</code> <code class="php plain">=&gt; </code><code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number2 index1 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'Application'</code><code class="php plain">,</code></div><div class="line number3 index2 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'DoctrineModule'</code><code class="php plain">,</code></div><div class="line number4 index3 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'DoctrineORMModule'</code><code class="php plain">,</code></div><div class="line number5 index4 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'Album'</code><code class="php plain">,</code></div><div class="line number6 index5 alt1"><code class="php plain">),</code></div></div></td></tr></tbody></table></div></div>
<p>Edit the Album module config file <strong>$PROJECT_DIR/module/Album/config/module.config.php</strong> to tell Doctrine how to work with the Album namespace. </p>
<p>First, specify the namespace at the top of the file:</p>
<div><div id="highlighter_914762" class="syntaxhighlighter  php"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="php plain">&lt;?php</code></div><div class="line number2 index1 alt1"><code class="php keyword">namespace</code> <code class="php plain">Album;</code></div></div></td></tr></tbody></table></div></div>
<p>This allows us to use the <strong>__NAMESPACE__</strong> magic constant in our configuration below.</p>
<p>Then add this “doctrine” section to the bottom of the returned array:</p>
<div><div id="highlighter_15433" class="syntaxhighlighter  php"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div><div class="line number18 index17 alt1">18</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="php keyword">return</code> <code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number2 index1 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php comments">// ...</code></div><div class="line number3 index2 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php comments">// Doctrine config</code></div><div class="line number4 index3 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'doctrine'</code> <code class="php plain">=&gt; </code><code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number5 index4 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'driver'</code> <code class="php plain">=&gt; </code><code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number6 index5 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">__NAMESPACE__ . </code><code class="php string">'_driver'</code> <code class="php plain">=&gt; </code><code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number7 index6 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'class'</code> <code class="php plain">=&gt; </code><code class="php string">'Doctrine\ORM\Mapping\Driver\AnnotationDriver'</code><code class="php plain">,</code></div><div class="line number8 index7 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'cache'</code> <code class="php plain">=&gt; </code><code class="php string">'array'</code><code class="php plain">,</code></div><div class="line number9 index8 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'paths'</code> <code class="php plain">=&gt; </code><code class="php keyword">array</code><code class="php plain">(__DIR__ . </code><code class="php string">'/../src/'</code> <code class="php plain">. __NAMESPACE__ . </code><code class="php string">'/Entity'</code><code class="php plain">)</code></div><div class="line number10 index9 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">),</code></div><div class="line number11 index10 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'orm_default'</code> <code class="php plain">=&gt; </code><code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number12 index11 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'drivers'</code> <code class="php plain">=&gt; </code><code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number13 index12 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">__NAMESPACE__ . </code><code class="php string">'\Entity'</code> <code class="php plain">=&gt; __NAMESPACE__ . </code><code class="php string">'_driver'</code></div><div class="line number14 index13 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">)</code></div><div class="line number15 index14 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">)</code></div><div class="line number16 index15 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">)</code></div><div class="line number17 index16 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">)</code></div><div class="line number18 index17 alt1"><code class="php plain">);</code></div></div></td></tr></tbody></table></div></div>
<p>You can see the complete <a href="https://github.com/jasongrimes/zf2tutorial/blob/master/module/Album/config/module.config.php">module.config.php file here.</a></p>
<p>Add the database connection information in <strong>config/autoload/local.php</strong>.</p>
<div><div id="highlighter_149476" class="syntaxhighlighter  php"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="php keyword">return</code> <code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number2 index1 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php comments">// ...</code></div><div class="line number3 index2 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'doctrine'</code> <code class="php plain">=&gt; </code><code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number4 index3 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'connection'</code> <code class="php plain">=&gt; </code><code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number5 index4 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'orm_default'</code> <code class="php plain">=&gt; </code><code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number6 index5 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'driverClass'</code> <code class="php plain">=&gt; </code><code class="php string">'Doctrine\DBAL\Driver\PDOMySql\Driver'</code><code class="php plain">,</code></div><div class="line number7 index6 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'params'</code> <code class="php plain">=&gt; </code><code class="php keyword">array</code><code class="php plain">(</code></div><div class="line number8 index7 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'host'</code>&nbsp;&nbsp;&nbsp;&nbsp; <code class="php plain">=&gt; </code><code class="php string">'localhost'</code><code class="php plain">,</code></div><div class="line number9 index8 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'port'</code>&nbsp;&nbsp;&nbsp;&nbsp; <code class="php plain">=&gt; </code><code class="php string">'3306'</code><code class="php plain">,</code></div><div class="line number10 index9 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'user'</code>&nbsp;&nbsp;&nbsp;&nbsp; <code class="php plain">=&gt; </code><code class="php string">''</code><code class="php plain">,</code></div><div class="line number11 index10 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'password'</code> <code class="php plain">=&gt; </code><code class="php string">''</code><code class="php plain">,</code></div><div class="line number12 index11 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php string">'dbname'</code>&nbsp;&nbsp; <code class="php plain">=&gt; </code><code class="php string">'zf2tutorial'</code><code class="php plain">,</code></div><div class="line number13 index12 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">)</code></div><div class="line number14 index13 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">)</code></div><div class="line number15 index14 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">)</code></div><div class="line number16 index15 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">),</code></div><div class="line number17 index16 alt2"><code class="php plain">);</code></div></div></td></tr></tbody></table></div></div>
<p>Then add code to the AlbumController to get the Doctrine EntityManager from the ZF service manager. Edit <strong>$PROJECT_DIR/module/Album/src/Album/Controller/AlbumController.php</strong> and make the following changes.</p>
<p>Import the EntityManager namespace:</p>
<div><div id="highlighter_526721" class="syntaxhighlighter  php"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="php keyword">use</code> <code class="php plain">Zend\Mvc\Controller\ActionController,</code></div><div class="line number2 index1 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">Zend\View\Model\ViewModel,</code></div><div class="line number3 index2 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">Album\Model\AlbumTable,</code></div><div class="line number4 index3 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">Album\Model\Album,</code></div><div class="line number5 index4 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">Album\Form\AlbumForm,</code></div><div class="line number6 index5 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">Doctrine\ORM\EntityManager;&nbsp;&nbsp;&nbsp;&nbsp; </code><code class="php comments">// Add this line</code></div></div></td></tr></tbody></table></div></div>
<p>Add a protected property and a getter method:</p>
<div><div id="highlighter_200768" class="syntaxhighlighter  php"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="php comments">/**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </code></div><div class="line number2 index1 alt1"><code class="php spaces">&nbsp;</code><code class="php comments">* @var Doctrine\ORM\EntityManager</code></div><div class="line number3 index2 alt2"><code class="php spaces">&nbsp;</code><code class="php comments">*/</code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div class="line number4 index3 alt1"><code class="php keyword">protected</code> <code class="php variable">$em</code><code class="php plain">;</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1"><code class="php keyword">public</code> <code class="php keyword">function</code> <code class="php plain">getEntityManager()</code></div><div class="line number7 index6 alt2"><code class="php plain">{</code></div><div class="line number8 index7 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php keyword">if</code> <code class="php plain">(null === </code><code class="php variable">$this</code><code class="php plain">-&gt;em) {</code></div><div class="line number9 index8 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php variable">$this</code><code class="php plain">-&gt;em = </code><code class="php variable">$this</code><code class="php plain">-&gt;getServiceLocator()-&gt;get(</code><code class="php string">'doctrine.entitymanager.orm_default'</code><code class="php plain">);</code></div><div class="line number10 index9 alt1"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php plain">}</code></div><div class="line number11 index10 alt2"><code class="php spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="php keyword">return</code> <code class="php variable">$this</code><code class="php plain">-&gt;em;</code></div><div class="line number12 index11 alt1"><code class="php plain">}</code></div></div></td></tr></tbody></table></div></div>
<p>You can now use <strong>$this-&gt;getEntityManager()</strong>&nbsp;within the AlbumController to&nbsp;access the Doctrine EntityManager.</p>
<h2>Create the Album entity<a name="toc-create-the-album-entity" style="text-decoration: none;">&nbsp;&nbsp;</a></h2>
<p>Now that Doctrine is configured, we’re ready to replace the Zend_Db code in the tutorial with a Doctrine version. </p>
<p>Create a Doctrine entity for the Album in <strong>$PROJECT_DIR/module/Album/src/Album/Entity/Album.php</strong>:</p>
<p><script src="Using_Doctrine_2_files/2861692.js"></script><link href="Using_Doctrine_2_files/embed-0af287a4b5c981db301049e56f06e5d3.css" media="screen" rel="stylesheet"></p><div id="gist2861692" class="gist">
      <div class="gist-file">
        <div class="gist-data gist-syntax">



  <div class="file-data">
    <table class="lines highlight" cellpadding="0" cellspacing="0">
      <tbody><tr>
        <td class="line-numbers">
          <span class="line-number" id="file-album-php-L1" rel="file-album-php-L1">1</span>
          <span class="line-number" id="file-album-php-L2" rel="file-album-php-L2">2</span>
          <span class="line-number" id="file-album-php-L3" rel="file-album-php-L3">3</span>
          <span class="line-number" id="file-album-php-L4" rel="file-album-php-L4">4</span>
          <span class="line-number" id="file-album-php-L5" rel="file-album-php-L5">5</span>
          <span class="line-number" id="file-album-php-L6" rel="file-album-php-L6">6</span>
          <span class="line-number" id="file-album-php-L7" rel="file-album-php-L7">7</span>
          <span class="line-number" id="file-album-php-L8" rel="file-album-php-L8">8</span>
          <span class="line-number" id="file-album-php-L9" rel="file-album-php-L9">9</span>
          <span class="line-number" id="file-album-php-L10" rel="file-album-php-L10">10</span>
          <span class="line-number" id="file-album-php-L11" rel="file-album-php-L11">11</span>
          <span class="line-number" id="file-album-php-L12" rel="file-album-php-L12">12</span>
          <span class="line-number" id="file-album-php-L13" rel="file-album-php-L13">13</span>
          <span class="line-number" id="file-album-php-L14" rel="file-album-php-L14">14</span>
          <span class="line-number" id="file-album-php-L15" rel="file-album-php-L15">15</span>
          <span class="line-number" id="file-album-php-L16" rel="file-album-php-L16">16</span>
          <span class="line-number" id="file-album-php-L17" rel="file-album-php-L17">17</span>
          <span class="line-number" id="file-album-php-L18" rel="file-album-php-L18">18</span>
          <span class="line-number" id="file-album-php-L19" rel="file-album-php-L19">19</span>
          <span class="line-number" id="file-album-php-L20" rel="file-album-php-L20">20</span>
          <span class="line-number" id="file-album-php-L21" rel="file-album-php-L21">21</span>
          <span class="line-number" id="file-album-php-L22" rel="file-album-php-L22">22</span>
          <span class="line-number" id="file-album-php-L23" rel="file-album-php-L23">23</span>
          <span class="line-number" id="file-album-php-L24" rel="file-album-php-L24">24</span>
          <span class="line-number" id="file-album-php-L25" rel="file-album-php-L25">25</span>
          <span class="line-number" id="file-album-php-L26" rel="file-album-php-L26">26</span>
          <span class="line-number" id="file-album-php-L27" rel="file-album-php-L27">27</span>
          <span class="line-number" id="file-album-php-L28" rel="file-album-php-L28">28</span>
          <span class="line-number" id="file-album-php-L29" rel="file-album-php-L29">29</span>
          <span class="line-number" id="file-album-php-L30" rel="file-album-php-L30">30</span>
          <span class="line-number" id="file-album-php-L31" rel="file-album-php-L31">31</span>
          <span class="line-number" id="file-album-php-L32" rel="file-album-php-L32">32</span>
          <span class="line-number" id="file-album-php-L33" rel="file-album-php-L33">33</span>
          <span class="line-number" id="file-album-php-L34" rel="file-album-php-L34">34</span>
          <span class="line-number" id="file-album-php-L35" rel="file-album-php-L35">35</span>
          <span class="line-number" id="file-album-php-L36" rel="file-album-php-L36">36</span>
          <span class="line-number" id="file-album-php-L37" rel="file-album-php-L37">37</span>
          <span class="line-number" id="file-album-php-L38" rel="file-album-php-L38">38</span>
          <span class="line-number" id="file-album-php-L39" rel="file-album-php-L39">39</span>
          <span class="line-number" id="file-album-php-L40" rel="file-album-php-L40">40</span>
          <span class="line-number" id="file-album-php-L41" rel="file-album-php-L41">41</span>
          <span class="line-number" id="file-album-php-L42" rel="file-album-php-L42">42</span>
          <span class="line-number" id="file-album-php-L43" rel="file-album-php-L43">43</span>
          <span class="line-number" id="file-album-php-L44" rel="file-album-php-L44">44</span>
          <span class="line-number" id="file-album-php-L45" rel="file-album-php-L45">45</span>
          <span class="line-number" id="file-album-php-L46" rel="file-album-php-L46">46</span>
          <span class="line-number" id="file-album-php-L47" rel="file-album-php-L47">47</span>
          <span class="line-number" id="file-album-php-L48" rel="file-album-php-L48">48</span>
          <span class="line-number" id="file-album-php-L49" rel="file-album-php-L49">49</span>
          <span class="line-number" id="file-album-php-L50" rel="file-album-php-L50">50</span>
          <span class="line-number" id="file-album-php-L51" rel="file-album-php-L51">51</span>
          <span class="line-number" id="file-album-php-L52" rel="file-album-php-L52">52</span>
          <span class="line-number" id="file-album-php-L53" rel="file-album-php-L53">53</span>
          <span class="line-number" id="file-album-php-L54" rel="file-album-php-L54">54</span>
          <span class="line-number" id="file-album-php-L55" rel="file-album-php-L55">55</span>
          <span class="line-number" id="file-album-php-L56" rel="file-album-php-L56">56</span>
          <span class="line-number" id="file-album-php-L57" rel="file-album-php-L57">57</span>
          <span class="line-number" id="file-album-php-L58" rel="file-album-php-L58">58</span>
          <span class="line-number" id="file-album-php-L59" rel="file-album-php-L59">59</span>
          <span class="line-number" id="file-album-php-L60" rel="file-album-php-L60">60</span>
          <span class="line-number" id="file-album-php-L61" rel="file-album-php-L61">61</span>
          <span class="line-number" id="file-album-php-L62" rel="file-album-php-L62">62</span>
          <span class="line-number" id="file-album-php-L63" rel="file-album-php-L63">63</span>
          <span class="line-number" id="file-album-php-L64" rel="file-album-php-L64">64</span>
          <span class="line-number" id="file-album-php-L65" rel="file-album-php-L65">65</span>
          <span class="line-number" id="file-album-php-L66" rel="file-album-php-L66">66</span>
          <span class="line-number" id="file-album-php-L67" rel="file-album-php-L67">67</span>
          <span class="line-number" id="file-album-php-L68" rel="file-album-php-L68">68</span>
          <span class="line-number" id="file-album-php-L69" rel="file-album-php-L69">69</span>
          <span class="line-number" id="file-album-php-L70" rel="file-album-php-L70">70</span>
          <span class="line-number" id="file-album-php-L71" rel="file-album-php-L71">71</span>
          <span class="line-number" id="file-album-php-L72" rel="file-album-php-L72">72</span>
          <span class="line-number" id="file-album-php-L73" rel="file-album-php-L73">73</span>
          <span class="line-number" id="file-album-php-L74" rel="file-album-php-L74">74</span>
          <span class="line-number" id="file-album-php-L75" rel="file-album-php-L75">75</span>
          <span class="line-number" id="file-album-php-L76" rel="file-album-php-L76">76</span>
          <span class="line-number" id="file-album-php-L77" rel="file-album-php-L77">77</span>
          <span class="line-number" id="file-album-php-L78" rel="file-album-php-L78">78</span>
          <span class="line-number" id="file-album-php-L79" rel="file-album-php-L79">79</span>
          <span class="line-number" id="file-album-php-L80" rel="file-album-php-L80">80</span>
          <span class="line-number" id="file-album-php-L81" rel="file-album-php-L81">81</span>
          <span class="line-number" id="file-album-php-L82" rel="file-album-php-L82">82</span>
          <span class="line-number" id="file-album-php-L83" rel="file-album-php-L83">83</span>
          <span class="line-number" id="file-album-php-L84" rel="file-album-php-L84">84</span>
          <span class="line-number" id="file-album-php-L85" rel="file-album-php-L85">85</span>
          <span class="line-number" id="file-album-php-L86" rel="file-album-php-L86">86</span>
          <span class="line-number" id="file-album-php-L87" rel="file-album-php-L87">87</span>
          <span class="line-number" id="file-album-php-L88" rel="file-album-php-L88">88</span>
          <span class="line-number" id="file-album-php-L89" rel="file-album-php-L89">89</span>
          <span class="line-number" id="file-album-php-L90" rel="file-album-php-L90">90</span>
          <span class="line-number" id="file-album-php-L91" rel="file-album-php-L91">91</span>
          <span class="line-number" id="file-album-php-L92" rel="file-album-php-L92">92</span>
          <span class="line-number" id="file-album-php-L93" rel="file-album-php-L93">93</span>
          <span class="line-number" id="file-album-php-L94" rel="file-album-php-L94">94</span>
          <span class="line-number" id="file-album-php-L95" rel="file-album-php-L95">95</span>
          <span class="line-number" id="file-album-php-L96" rel="file-album-php-L96">96</span>
          <span class="line-number" id="file-album-php-L97" rel="file-album-php-L97">97</span>
          <span class="line-number" id="file-album-php-L98" rel="file-album-php-L98">98</span>
          <span class="line-number" id="file-album-php-L99" rel="file-album-php-L99">99</span>
          <span class="line-number" id="file-album-php-L100" rel="file-album-php-L100">100</span>
          <span class="line-number" id="file-album-php-L101" rel="file-album-php-L101">101</span>
          <span class="line-number" id="file-album-php-L102" rel="file-album-php-L102">102</span>
          <span class="line-number" id="file-album-php-L103" rel="file-album-php-L103">103</span>
          <span class="line-number" id="file-album-php-L104" rel="file-album-php-L104">104</span>
          <span class="line-number" id="file-album-php-L105" rel="file-album-php-L105">105</span>
          <span class="line-number" id="file-album-php-L106" rel="file-album-php-L106">106</span>
          <span class="line-number" id="file-album-php-L107" rel="file-album-php-L107">107</span>
          <span class="line-number" id="file-album-php-L108" rel="file-album-php-L108">108</span>
          <span class="line-number" id="file-album-php-L109" rel="file-album-php-L109">109</span>
          <span class="line-number" id="file-album-php-L110" rel="file-album-php-L110">110</span>
          <span class="line-number" id="file-album-php-L111" rel="file-album-php-L111">111</span>
          <span class="line-number" id="file-album-php-L112" rel="file-album-php-L112">112</span>
          <span class="line-number" id="file-album-php-L113" rel="file-album-php-L113">113</span>
          <span class="line-number" id="file-album-php-L114" rel="file-album-php-L114">114</span>
          <span class="line-number" id="file-album-php-L115" rel="file-album-php-L115">115</span>
          <span class="line-number" id="file-album-php-L116" rel="file-album-php-L116">116</span>
          <span class="line-number" id="file-album-php-L117" rel="file-album-php-L117">117</span>
          <span class="line-number" id="file-album-php-L118" rel="file-album-php-L118">118</span>
          <span class="line-number" id="file-album-php-L119" rel="file-album-php-L119">119</span>
          <span class="line-number" id="file-album-php-L120" rel="file-album-php-L120">120</span>
          <span class="line-number" id="file-album-php-L121" rel="file-album-php-L121">121</span>
          <span class="line-number" id="file-album-php-L122" rel="file-album-php-L122">122</span>
          <span class="line-number" id="file-album-php-L123" rel="file-album-php-L123">123</span>
          <span class="line-number" id="file-album-php-L124" rel="file-album-php-L124">124</span>
          <span class="line-number" id="file-album-php-L125" rel="file-album-php-L125">125</span>
          <span class="line-number" id="file-album-php-L126" rel="file-album-php-L126">126</span>
          <span class="line-number" id="file-album-php-L127" rel="file-album-php-L127">127</span>
          <span class="line-number" id="file-album-php-L128" rel="file-album-php-L128">128</span>
          <span class="line-number" id="file-album-php-L129" rel="file-album-php-L129">129</span>
          <span class="line-number" id="file-album-php-L130" rel="file-album-php-L130">130</span>
          <span class="line-number" id="file-album-php-L131" rel="file-album-php-L131">131</span>
          <span class="line-number" id="file-album-php-L132" rel="file-album-php-L132">132</span>
          <span class="line-number" id="file-album-php-L133" rel="file-album-php-L133">133</span>
          <span class="line-number" id="file-album-php-L134" rel="file-album-php-L134">134</span>
          <span class="line-number" id="file-album-php-L135" rel="file-album-php-L135">135</span>
          <span class="line-number" id="file-album-php-L136" rel="file-album-php-L136">136</span>
          <span class="line-number" id="file-album-php-L137" rel="file-album-php-L137">137</span>
          <span class="line-number" id="file-album-php-L138" rel="file-album-php-L138">138</span>
          <span class="line-number" id="file-album-php-L139" rel="file-album-php-L139">139</span>
          <span class="line-number" id="file-album-php-L140" rel="file-album-php-L140">140</span>
          <span class="line-number" id="file-album-php-L141" rel="file-album-php-L141">141</span>
          <span class="line-number" id="file-album-php-L142" rel="file-album-php-L142">142</span>
          <span class="line-number" id="file-album-php-L143" rel="file-album-php-L143">143</span>
          <span class="line-number" id="file-album-php-L144" rel="file-album-php-L144">144</span>
          <span class="line-number" id="file-album-php-L145" rel="file-album-php-L145">145</span>
          <span class="line-number" id="file-album-php-L146" rel="file-album-php-L146">146</span>
          <span class="line-number" id="file-album-php-L147" rel="file-album-php-L147">147</span>
          <span class="line-number" id="file-album-php-L148" rel="file-album-php-L148">148</span>
        </td>
        <td class="line-data">
          <pre class="line-pre"><div class="line" id="file-album-php-LC1"><span class="cp">&lt;?php</span></div><div class="line" id="file-album-php-LC2">&nbsp;</div><div class="line" id="file-album-php-LC3"><span class="k">namespace</span> <span class="nx">Album\Entity</span><span class="p">;</span></div><div class="line" id="file-album-php-LC4">&nbsp;</div><div class="line" id="file-album-php-LC5"><span class="k">use</span> <span class="nx">Doctrine\ORM\Mapping</span> <span class="k">as</span> <span class="nx">ORM</span><span class="p">;</span></div><div class="line" id="file-album-php-LC6"><span class="k">use</span> <span class="nx">Zend\InputFilter\InputFilter</span><span class="p">;</span></div><div class="line" id="file-album-php-LC7"><span class="k">use</span> <span class="nx">Zend\InputFilter\Factory</span> <span class="k">as</span> <span class="nx">InputFactory</span><span class="p">;</span></div><div class="line" id="file-album-php-LC8"><span class="k">use</span> <span class="nx">Zend\InputFilter\InputFilterAwareInterface</span><span class="p">;</span></div><div class="line" id="file-album-php-LC9"><span class="k">use</span> <span class="nx">Zend\InputFilter\InputFilterInterface</span><span class="p">;</span> </div><div class="line" id="file-album-php-LC10">&nbsp;</div><div class="line" id="file-album-php-LC11"><span class="sd">/**</span></div><div class="line" id="file-album-php-LC12"><span class="sd"> * A music album.</span></div><div class="line" id="file-album-php-LC13"><span class="sd"> *</span></div><div class="line" id="file-album-php-LC14"><span class="sd"> * @ORM\Entity</span></div><div class="line" id="file-album-php-LC15"><span class="sd"> * @ORM\Table(name="album")</span></div><div class="line" id="file-album-php-LC16"><span class="sd"> * @property string $artist</span></div><div class="line" id="file-album-php-LC17"><span class="sd"> * @property string $title</span></div><div class="line" id="file-album-php-LC18"><span class="sd"> * @property int $id</span></div><div class="line" id="file-album-php-LC19"><span class="sd"> */</span></div><div class="line" id="file-album-php-LC20"><span class="k">class</span> <span class="nc">Album</span> <span class="k">implements</span> <span class="nx">InputFilterAwareInterface</span> </div><div class="line" id="file-album-php-LC21"><span class="p">{</span></div><div class="line" id="file-album-php-LC22">    <span class="k">protected</span> <span class="nv">$inputFilter</span><span class="p">;</span></div><div class="line" id="file-album-php-LC23">&nbsp;</div><div class="line" id="file-album-php-LC24">    <span class="sd">/**</span></div><div class="line" id="file-album-php-LC25"><span class="sd">     * @ORM\Id</span></div><div class="line" id="file-album-php-LC26"><span class="sd">     * @ORM\Column(type="integer");</span></div><div class="line" id="file-album-php-LC27"><span class="sd">     * @ORM\GeneratedValue(strategy="AUTO")</span></div><div class="line" id="file-album-php-LC28"><span class="sd">     */</span></div><div class="line" id="file-album-php-LC29">    <span class="k">protected</span> <span class="nv">$id</span><span class="p">;</span></div><div class="line" id="file-album-php-LC30">&nbsp;</div><div class="line" id="file-album-php-LC31">    <span class="sd">/**</span></div><div class="line" id="file-album-php-LC32"><span class="sd">     * @ORM\Column(type="string")</span></div><div class="line" id="file-album-php-LC33"><span class="sd">     */</span></div><div class="line" id="file-album-php-LC34">    <span class="k">protected</span> <span class="nv">$artist</span><span class="p">;</span></div><div class="line" id="file-album-php-LC35">&nbsp;</div><div class="line" id="file-album-php-LC36">    <span class="sd">/**</span></div><div class="line" id="file-album-php-LC37"><span class="sd">     * @ORM\Column(type="string")</span></div><div class="line" id="file-album-php-LC38"><span class="sd">     */</span></div><div class="line" id="file-album-php-LC39">    <span class="k">protected</span> <span class="nv">$title</span><span class="p">;</span></div><div class="line" id="file-album-php-LC40">&nbsp;</div><div class="line" id="file-album-php-LC41">    <span class="sd">/**</span></div><div class="line" id="file-album-php-LC42"><span class="sd">     * Magic getter to expose protected properties.</span></div><div class="line" id="file-album-php-LC43"><span class="sd">     *</span></div><div class="line" id="file-album-php-LC44"><span class="sd">     * @param string $property</span></div><div class="line" id="file-album-php-LC45"><span class="sd">     * @return mixed</span></div><div class="line" id="file-album-php-LC46"><span class="sd">     */</span></div><div class="line" id="file-album-php-LC47">    <span class="k">public</span> <span class="k">function</span> <span class="nf">__get</span><span class="p">(</span><span class="nv">$property</span><span class="p">)</span> </div><div class="line" id="file-album-php-LC48">    <span class="p">{</span></div><div class="line" id="file-album-php-LC49">        <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="nv">$property</span><span class="p">;</span></div><div class="line" id="file-album-php-LC50">    <span class="p">}</span></div><div class="line" id="file-album-php-LC51">&nbsp;</div><div class="line" id="file-album-php-LC52">    <span class="sd">/**</span></div><div class="line" id="file-album-php-LC53"><span class="sd">     * Magic setter to save protected properties.</span></div><div class="line" id="file-album-php-LC54"><span class="sd">     *</span></div><div class="line" id="file-album-php-LC55"><span class="sd">     * @param string $property</span></div><div class="line" id="file-album-php-LC56"><span class="sd">     * @param mixed $value</span></div><div class="line" id="file-album-php-LC57"><span class="sd">     */</span></div><div class="line" id="file-album-php-LC58">    <span class="k">public</span> <span class="k">function</span> <span class="nf">__set</span><span class="p">(</span><span class="nv">$property</span><span class="p">,</span> <span class="nv">$value</span><span class="p">)</span> </div><div class="line" id="file-album-php-LC59">    <span class="p">{</span></div><div class="line" id="file-album-php-LC60">        <span class="nv">$this</span><span class="o">-&gt;</span><span class="nv">$property</span> <span class="o">=</span> <span class="nv">$value</span><span class="p">;</span></div><div class="line" id="file-album-php-LC61">    <span class="p">}</span></div><div class="line" id="file-album-php-LC62">&nbsp;</div><div class="line" id="file-album-php-LC63">    <span class="sd">/**</span></div><div class="line" id="file-album-php-LC64"><span class="sd">     * Convert the object to an array.</span></div><div class="line" id="file-album-php-LC65"><span class="sd">     *</span></div><div class="line" id="file-album-php-LC66"><span class="sd">     * @return array</span></div><div class="line" id="file-album-php-LC67"><span class="sd">     */</span></div><div class="line" id="file-album-php-LC68">    <span class="k">public</span> <span class="k">function</span> <span class="nf">getArrayCopy</span><span class="p">()</span> </div><div class="line" id="file-album-php-LC69">    <span class="p">{</span></div><div class="line" id="file-album-php-LC70">        <span class="k">return</span> <span class="nb">get_object_vars</span><span class="p">(</span><span class="nv">$this</span><span class="p">);</span></div><div class="line" id="file-album-php-LC71">    <span class="p">}</span></div><div class="line" id="file-album-php-LC72">&nbsp;</div><div class="line" id="file-album-php-LC73">    <span class="sd">/**</span></div><div class="line" id="file-album-php-LC74"><span class="sd">     * Populate from an array.</span></div><div class="line" id="file-album-php-LC75"><span class="sd">     *</span></div><div class="line" id="file-album-php-LC76"><span class="sd">     * @param array $data</span></div><div class="line" id="file-album-php-LC77"><span class="sd">     */</span></div><div class="line" id="file-album-php-LC78">    <span class="k">public</span> <span class="k">function</span> <span class="nf">populate</span><span class="p">(</span><span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">())</span> </div><div class="line" id="file-album-php-LC79">    <span class="p">{</span></div><div class="line" id="file-album-php-LC80">        <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">id</span> <span class="o">=</span> <span class="nv">$data</span><span class="p">[</span><span class="s1">'id'</span><span class="p">];</span></div><div class="line" id="file-album-php-LC81">        <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">artist</span> <span class="o">=</span> <span class="nv">$data</span><span class="p">[</span><span class="s1">'artist'</span><span class="p">];</span></div><div class="line" id="file-album-php-LC82">        <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">title</span> <span class="o">=</span> <span class="nv">$data</span><span class="p">[</span><span class="s1">'title'</span><span class="p">];</span></div><div class="line" id="file-album-php-LC83">    <span class="p">}</span></div><div class="line" id="file-album-php-LC84">&nbsp;</div><div class="line" id="file-album-php-LC85">    <span class="k">public</span> <span class="k">function</span> <span class="nf">setInputFilter</span><span class="p">(</span><span class="nx">InputFilterInterface</span> <span class="nv">$inputFilter</span><span class="p">)</span></div><div class="line" id="file-album-php-LC86">    <span class="p">{</span></div><div class="line" id="file-album-php-LC87">        <span class="k">throw</span> <span class="k">new</span> <span class="nx">\Exception</span><span class="p">(</span><span class="s2">"Not used"</span><span class="p">);</span></div><div class="line" id="file-album-php-LC88">    <span class="p">}</span></div><div class="line" id="file-album-php-LC89">&nbsp;</div><div class="line" id="file-album-php-LC90">    <span class="k">public</span> <span class="k">function</span> <span class="nf">getInputFilter</span><span class="p">()</span></div><div class="line" id="file-album-php-LC91">    <span class="p">{</span></div><div class="line" id="file-album-php-LC92">        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">inputFilter</span><span class="p">)</span> <span class="p">{</span></div><div class="line" id="file-album-php-LC93">            <span class="nv">$inputFilter</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">InputFilter</span><span class="p">();</span></div><div class="line" id="file-album-php-LC94">&nbsp;</div><div class="line" id="file-album-php-LC95">            <span class="nv">$factory</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">InputFactory</span><span class="p">();</span></div><div class="line" id="file-album-php-LC96">&nbsp;</div><div class="line" id="file-album-php-LC97">            <span class="nv">$inputFilter</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span><span class="nv">$factory</span><span class="o">-&gt;</span><span class="na">createInput</span><span class="p">(</span><span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC98">                <span class="s1">'name'</span>       <span class="o">=&gt;</span> <span class="s1">'id'</span><span class="p">,</span></div><div class="line" id="file-album-php-LC99">                <span class="s1">'required'</span>   <span class="o">=&gt;</span> <span class="k">true</span><span class="p">,</span></div><div class="line" id="file-album-php-LC100">                <span class="s1">'filters'</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC101">                    <span class="k">array</span><span class="p">(</span><span class="s1">'name'</span>    <span class="o">=&gt;</span> <span class="s1">'Int'</span><span class="p">),</span></div><div class="line" id="file-album-php-LC102">                <span class="p">),</span></div><div class="line" id="file-album-php-LC103">            <span class="p">)));</span></div><div class="line" id="file-album-php-LC104">&nbsp;</div><div class="line" id="file-album-php-LC105">            <span class="nv">$inputFilter</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span><span class="nv">$factory</span><span class="o">-&gt;</span><span class="na">createInput</span><span class="p">(</span><span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC106">                <span class="s1">'name'</span>     <span class="o">=&gt;</span> <span class="s1">'artist'</span><span class="p">,</span></div><div class="line" id="file-album-php-LC107">                <span class="s1">'required'</span> <span class="o">=&gt;</span> <span class="k">true</span><span class="p">,</span></div><div class="line" id="file-album-php-LC108">                <span class="s1">'filters'</span>  <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC109">                    <span class="k">array</span><span class="p">(</span><span class="s1">'name'</span> <span class="o">=&gt;</span> <span class="s1">'StripTags'</span><span class="p">),</span></div><div class="line" id="file-album-php-LC110">                    <span class="k">array</span><span class="p">(</span><span class="s1">'name'</span> <span class="o">=&gt;</span> <span class="s1">'StringTrim'</span><span class="p">),</span></div><div class="line" id="file-album-php-LC111">                <span class="p">),</span></div><div class="line" id="file-album-php-LC112">                <span class="s1">'validators'</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC113">                    <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC114">                        <span class="s1">'name'</span>    <span class="o">=&gt;</span> <span class="s1">'StringLength'</span><span class="p">,</span></div><div class="line" id="file-album-php-LC115">                        <span class="s1">'options'</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC116">                            <span class="s1">'encoding'</span> <span class="o">=&gt;</span> <span class="s1">'UTF-8'</span><span class="p">,</span></div><div class="line" id="file-album-php-LC117">                            <span class="s1">'min'</span>      <span class="o">=&gt;</span> <span class="mi">1</span><span class="p">,</span></div><div class="line" id="file-album-php-LC118">                            <span class="s1">'max'</span>      <span class="o">=&gt;</span> <span class="mi">100</span><span class="p">,</span></div><div class="line" id="file-album-php-LC119">                        <span class="p">),</span></div><div class="line" id="file-album-php-LC120">                    <span class="p">),</span></div><div class="line" id="file-album-php-LC121">                <span class="p">),</span></div><div class="line" id="file-album-php-LC122">            <span class="p">)));</span></div><div class="line" id="file-album-php-LC123">&nbsp;</div><div class="line" id="file-album-php-LC124">            <span class="nv">$inputFilter</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span><span class="nv">$factory</span><span class="o">-&gt;</span><span class="na">createInput</span><span class="p">(</span><span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC125">                <span class="s1">'name'</span>     <span class="o">=&gt;</span> <span class="s1">'title'</span><span class="p">,</span></div><div class="line" id="file-album-php-LC126">                <span class="s1">'required'</span> <span class="o">=&gt;</span> <span class="k">true</span><span class="p">,</span></div><div class="line" id="file-album-php-LC127">                <span class="s1">'filters'</span>  <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC128">                    <span class="k">array</span><span class="p">(</span><span class="s1">'name'</span> <span class="o">=&gt;</span> <span class="s1">'StripTags'</span><span class="p">),</span></div><div class="line" id="file-album-php-LC129">                    <span class="k">array</span><span class="p">(</span><span class="s1">'name'</span> <span class="o">=&gt;</span> <span class="s1">'StringTrim'</span><span class="p">),</span></div><div class="line" id="file-album-php-LC130">                <span class="p">),</span></div><div class="line" id="file-album-php-LC131">                <span class="s1">'validators'</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC132">                    <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC133">                        <span class="s1">'name'</span>    <span class="o">=&gt;</span> <span class="s1">'StringLength'</span><span class="p">,</span></div><div class="line" id="file-album-php-LC134">                        <span class="s1">'options'</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-album-php-LC135">                            <span class="s1">'encoding'</span> <span class="o">=&gt;</span> <span class="s1">'UTF-8'</span><span class="p">,</span></div><div class="line" id="file-album-php-LC136">                            <span class="s1">'min'</span>      <span class="o">=&gt;</span> <span class="mi">1</span><span class="p">,</span></div><div class="line" id="file-album-php-LC137">                            <span class="s1">'max'</span>      <span class="o">=&gt;</span> <span class="mi">100</span><span class="p">,</span></div><div class="line" id="file-album-php-LC138">                        <span class="p">),</span></div><div class="line" id="file-album-php-LC139">                    <span class="p">),</span></div><div class="line" id="file-album-php-LC140">                <span class="p">),</span></div><div class="line" id="file-album-php-LC141">            <span class="p">)));</span></div><div class="line" id="file-album-php-LC142">&nbsp;</div><div class="line" id="file-album-php-LC143">            <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">inputFilter</span> <span class="o">=</span> <span class="nv">$inputFilter</span><span class="p">;</span>        </div><div class="line" id="file-album-php-LC144">        <span class="p">}</span></div><div class="line" id="file-album-php-LC145">&nbsp;</div><div class="line" id="file-album-php-LC146">        <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">inputFilter</span><span class="p">;</span></div><div class="line" id="file-album-php-LC147">    <span class="p">}</span> </div><div class="line" id="file-album-php-LC148"><span class="p">}</span></div></pre>
        </td>
      </tr>
    </tbody></table>
  </div>

        </div>

        <div class="gist-meta">
          <a href="https://gist.github.com/jasongrimes/2861692/raw/36f5422f92adfb3c14aad4dd7c3a58fdad76037a/Album.php" style="float:right">view raw</a>
          <a href="https://gist.github.com/jasongrimes/2861692#file-album-php" style="float:right; margin-right:10px; color:#666;">Album.php</a>
          <a href="https://gist.github.com/jasongrimes/2861692">This Gist</a> brought to you by <a href="http://github.com/">GitHub</a>.
        </div>
      </div>
</div>
<p></p>
<p>In addition to the typical Doctrine entity stuff, the Album entity implements the <code>InputFilterAwareInterface</code>, along with <code>populate()</code> and <code>getArrayCopy()</code> methods. This allows it to work with the new features in Zend\Form.</p>
<h2>Update the Album controller to use Doctrine instead of Zend_Db<a name="toc-update-the-album-controller-to-use-doctrine-instead-of-zend_db" style="text-decoration: none;">&nbsp;&nbsp;</a></h2>
<p>Finally, we’ll update each action to use Doctrine and the Album class instead of Zend_Db and the AlbumTable class.</p>
<p>Here’s the original version of the controller from the Getting Started tutorial (as of this writing):</p>
<p><script src="Using_Doctrine_2_files/1698969.js"></script><link href="Using_Doctrine_2_files/embed-0af287a4b5c981db301049e56f06e5d3.css" media="screen" rel="stylesheet"></p><div id="gist1698969" class="gist">
      <div class="gist-file">
        <div class="gist-data gist-syntax">



  <div class="file-data">
    <table class="lines highlight" cellpadding="0" cellspacing="0">
      <tbody><tr>
        <td class="line-numbers">
          <span class="line-number" id="file-albumcontroller-php-L1" rel="file-albumcontroller-php-L1">1</span>
          <span class="line-number" id="file-albumcontroller-php-L2" rel="file-albumcontroller-php-L2">2</span>
          <span class="line-number" id="file-albumcontroller-php-L3" rel="file-albumcontroller-php-L3">3</span>
          <span class="line-number" id="file-albumcontroller-php-L4" rel="file-albumcontroller-php-L4">4</span>
          <span class="line-number" id="file-albumcontroller-php-L5" rel="file-albumcontroller-php-L5">5</span>
          <span class="line-number" id="file-albumcontroller-php-L6" rel="file-albumcontroller-php-L6">6</span>
          <span class="line-number" id="file-albumcontroller-php-L7" rel="file-albumcontroller-php-L7">7</span>
          <span class="line-number" id="file-albumcontroller-php-L8" rel="file-albumcontroller-php-L8">8</span>
          <span class="line-number" id="file-albumcontroller-php-L9" rel="file-albumcontroller-php-L9">9</span>
          <span class="line-number" id="file-albumcontroller-php-L10" rel="file-albumcontroller-php-L10">10</span>
          <span class="line-number" id="file-albumcontroller-php-L11" rel="file-albumcontroller-php-L11">11</span>
          <span class="line-number" id="file-albumcontroller-php-L12" rel="file-albumcontroller-php-L12">12</span>
          <span class="line-number" id="file-albumcontroller-php-L13" rel="file-albumcontroller-php-L13">13</span>
          <span class="line-number" id="file-albumcontroller-php-L14" rel="file-albumcontroller-php-L14">14</span>
          <span class="line-number" id="file-albumcontroller-php-L15" rel="file-albumcontroller-php-L15">15</span>
          <span class="line-number" id="file-albumcontroller-php-L16" rel="file-albumcontroller-php-L16">16</span>
          <span class="line-number" id="file-albumcontroller-php-L17" rel="file-albumcontroller-php-L17">17</span>
          <span class="line-number" id="file-albumcontroller-php-L18" rel="file-albumcontroller-php-L18">18</span>
          <span class="line-number" id="file-albumcontroller-php-L19" rel="file-albumcontroller-php-L19">19</span>
          <span class="line-number" id="file-albumcontroller-php-L20" rel="file-albumcontroller-php-L20">20</span>
          <span class="line-number" id="file-albumcontroller-php-L21" rel="file-albumcontroller-php-L21">21</span>
          <span class="line-number" id="file-albumcontroller-php-L22" rel="file-albumcontroller-php-L22">22</span>
          <span class="line-number" id="file-albumcontroller-php-L23" rel="file-albumcontroller-php-L23">23</span>
          <span class="line-number" id="file-albumcontroller-php-L24" rel="file-albumcontroller-php-L24">24</span>
          <span class="line-number" id="file-albumcontroller-php-L25" rel="file-albumcontroller-php-L25">25</span>
          <span class="line-number" id="file-albumcontroller-php-L26" rel="file-albumcontroller-php-L26">26</span>
          <span class="line-number" id="file-albumcontroller-php-L27" rel="file-albumcontroller-php-L27">27</span>
          <span class="line-number" id="file-albumcontroller-php-L28" rel="file-albumcontroller-php-L28">28</span>
          <span class="line-number" id="file-albumcontroller-php-L29" rel="file-albumcontroller-php-L29">29</span>
          <span class="line-number" id="file-albumcontroller-php-L30" rel="file-albumcontroller-php-L30">30</span>
          <span class="line-number" id="file-albumcontroller-php-L31" rel="file-albumcontroller-php-L31">31</span>
          <span class="line-number" id="file-albumcontroller-php-L32" rel="file-albumcontroller-php-L32">32</span>
          <span class="line-number" id="file-albumcontroller-php-L33" rel="file-albumcontroller-php-L33">33</span>
          <span class="line-number" id="file-albumcontroller-php-L34" rel="file-albumcontroller-php-L34">34</span>
          <span class="line-number" id="file-albumcontroller-php-L35" rel="file-albumcontroller-php-L35">35</span>
          <span class="line-number" id="file-albumcontroller-php-L36" rel="file-albumcontroller-php-L36">36</span>
          <span class="line-number" id="file-albumcontroller-php-L37" rel="file-albumcontroller-php-L37">37</span>
          <span class="line-number" id="file-albumcontroller-php-L38" rel="file-albumcontroller-php-L38">38</span>
          <span class="line-number" id="file-albumcontroller-php-L39" rel="file-albumcontroller-php-L39">39</span>
          <span class="line-number" id="file-albumcontroller-php-L40" rel="file-albumcontroller-php-L40">40</span>
          <span class="line-number" id="file-albumcontroller-php-L41" rel="file-albumcontroller-php-L41">41</span>
          <span class="line-number" id="file-albumcontroller-php-L42" rel="file-albumcontroller-php-L42">42</span>
          <span class="line-number" id="file-albumcontroller-php-L43" rel="file-albumcontroller-php-L43">43</span>
          <span class="line-number" id="file-albumcontroller-php-L44" rel="file-albumcontroller-php-L44">44</span>
          <span class="line-number" id="file-albumcontroller-php-L45" rel="file-albumcontroller-php-L45">45</span>
          <span class="line-number" id="file-albumcontroller-php-L46" rel="file-albumcontroller-php-L46">46</span>
          <span class="line-number" id="file-albumcontroller-php-L47" rel="file-albumcontroller-php-L47">47</span>
          <span class="line-number" id="file-albumcontroller-php-L48" rel="file-albumcontroller-php-L48">48</span>
          <span class="line-number" id="file-albumcontroller-php-L49" rel="file-albumcontroller-php-L49">49</span>
          <span class="line-number" id="file-albumcontroller-php-L50" rel="file-albumcontroller-php-L50">50</span>
          <span class="line-number" id="file-albumcontroller-php-L51" rel="file-albumcontroller-php-L51">51</span>
          <span class="line-number" id="file-albumcontroller-php-L52" rel="file-albumcontroller-php-L52">52</span>
          <span class="line-number" id="file-albumcontroller-php-L53" rel="file-albumcontroller-php-L53">53</span>
          <span class="line-number" id="file-albumcontroller-php-L54" rel="file-albumcontroller-php-L54">54</span>
          <span class="line-number" id="file-albumcontroller-php-L55" rel="file-albumcontroller-php-L55">55</span>
          <span class="line-number" id="file-albumcontroller-php-L56" rel="file-albumcontroller-php-L56">56</span>
          <span class="line-number" id="file-albumcontroller-php-L57" rel="file-albumcontroller-php-L57">57</span>
          <span class="line-number" id="file-albumcontroller-php-L58" rel="file-albumcontroller-php-L58">58</span>
          <span class="line-number" id="file-albumcontroller-php-L59" rel="file-albumcontroller-php-L59">59</span>
          <span class="line-number" id="file-albumcontroller-php-L60" rel="file-albumcontroller-php-L60">60</span>
          <span class="line-number" id="file-albumcontroller-php-L61" rel="file-albumcontroller-php-L61">61</span>
          <span class="line-number" id="file-albumcontroller-php-L62" rel="file-albumcontroller-php-L62">62</span>
          <span class="line-number" id="file-albumcontroller-php-L63" rel="file-albumcontroller-php-L63">63</span>
          <span class="line-number" id="file-albumcontroller-php-L64" rel="file-albumcontroller-php-L64">64</span>
          <span class="line-number" id="file-albumcontroller-php-L65" rel="file-albumcontroller-php-L65">65</span>
          <span class="line-number" id="file-albumcontroller-php-L66" rel="file-albumcontroller-php-L66">66</span>
          <span class="line-number" id="file-albumcontroller-php-L67" rel="file-albumcontroller-php-L67">67</span>
          <span class="line-number" id="file-albumcontroller-php-L68" rel="file-albumcontroller-php-L68">68</span>
          <span class="line-number" id="file-albumcontroller-php-L69" rel="file-albumcontroller-php-L69">69</span>
          <span class="line-number" id="file-albumcontroller-php-L70" rel="file-albumcontroller-php-L70">70</span>
          <span class="line-number" id="file-albumcontroller-php-L71" rel="file-albumcontroller-php-L71">71</span>
          <span class="line-number" id="file-albumcontroller-php-L72" rel="file-albumcontroller-php-L72">72</span>
          <span class="line-number" id="file-albumcontroller-php-L73" rel="file-albumcontroller-php-L73">73</span>
          <span class="line-number" id="file-albumcontroller-php-L74" rel="file-albumcontroller-php-L74">74</span>
          <span class="line-number" id="file-albumcontroller-php-L75" rel="file-albumcontroller-php-L75">75</span>
          <span class="line-number" id="file-albumcontroller-php-L76" rel="file-albumcontroller-php-L76">76</span>
          <span class="line-number" id="file-albumcontroller-php-L77" rel="file-albumcontroller-php-L77">77</span>
          <span class="line-number" id="file-albumcontroller-php-L78" rel="file-albumcontroller-php-L78">78</span>
          <span class="line-number" id="file-albumcontroller-php-L79" rel="file-albumcontroller-php-L79">79</span>
          <span class="line-number" id="file-albumcontroller-php-L80" rel="file-albumcontroller-php-L80">80</span>
          <span class="line-number" id="file-albumcontroller-php-L81" rel="file-albumcontroller-php-L81">81</span>
          <span class="line-number" id="file-albumcontroller-php-L82" rel="file-albumcontroller-php-L82">82</span>
          <span class="line-number" id="file-albumcontroller-php-L83" rel="file-albumcontroller-php-L83">83</span>
          <span class="line-number" id="file-albumcontroller-php-L84" rel="file-albumcontroller-php-L84">84</span>
          <span class="line-number" id="file-albumcontroller-php-L85" rel="file-albumcontroller-php-L85">85</span>
          <span class="line-number" id="file-albumcontroller-php-L86" rel="file-albumcontroller-php-L86">86</span>
          <span class="line-number" id="file-albumcontroller-php-L87" rel="file-albumcontroller-php-L87">87</span>
          <span class="line-number" id="file-albumcontroller-php-L88" rel="file-albumcontroller-php-L88">88</span>
          <span class="line-number" id="file-albumcontroller-php-L89" rel="file-albumcontroller-php-L89">89</span>
          <span class="line-number" id="file-albumcontroller-php-L90" rel="file-albumcontroller-php-L90">90</span>
          <span class="line-number" id="file-albumcontroller-php-L91" rel="file-albumcontroller-php-L91">91</span>
          <span class="line-number" id="file-albumcontroller-php-L92" rel="file-albumcontroller-php-L92">92</span>
          <span class="line-number" id="file-albumcontroller-php-L93" rel="file-albumcontroller-php-L93">93</span>
          <span class="line-number" id="file-albumcontroller-php-L94" rel="file-albumcontroller-php-L94">94</span>
          <span class="line-number" id="file-albumcontroller-php-L95" rel="file-albumcontroller-php-L95">95</span>
          <span class="line-number" id="file-albumcontroller-php-L96" rel="file-albumcontroller-php-L96">96</span>
          <span class="line-number" id="file-albumcontroller-php-L97" rel="file-albumcontroller-php-L97">97</span>
          <span class="line-number" id="file-albumcontroller-php-L98" rel="file-albumcontroller-php-L98">98</span>
          <span class="line-number" id="file-albumcontroller-php-L99" rel="file-albumcontroller-php-L99">99</span>
          <span class="line-number" id="file-albumcontroller-php-L100" rel="file-albumcontroller-php-L100">100</span>
          <span class="line-number" id="file-albumcontroller-php-L101" rel="file-albumcontroller-php-L101">101</span>
          <span class="line-number" id="file-albumcontroller-php-L102" rel="file-albumcontroller-php-L102">102</span>
          <span class="line-number" id="file-albumcontroller-php-L103" rel="file-albumcontroller-php-L103">103</span>
          <span class="line-number" id="file-albumcontroller-php-L104" rel="file-albumcontroller-php-L104">104</span>
          <span class="line-number" id="file-albumcontroller-php-L105" rel="file-albumcontroller-php-L105">105</span>
          <span class="line-number" id="file-albumcontroller-php-L106" rel="file-albumcontroller-php-L106">106</span>
          <span class="line-number" id="file-albumcontroller-php-L107" rel="file-albumcontroller-php-L107">107</span>
          <span class="line-number" id="file-albumcontroller-php-L108" rel="file-albumcontroller-php-L108">108</span>
          <span class="line-number" id="file-albumcontroller-php-L109" rel="file-albumcontroller-php-L109">109</span>
          <span class="line-number" id="file-albumcontroller-php-L110" rel="file-albumcontroller-php-L110">110</span>
          <span class="line-number" id="file-albumcontroller-php-L111" rel="file-albumcontroller-php-L111">111</span>
          <span class="line-number" id="file-albumcontroller-php-L112" rel="file-albumcontroller-php-L112">112</span>
          <span class="line-number" id="file-albumcontroller-php-L113" rel="file-albumcontroller-php-L113">113</span>
          <span class="line-number" id="file-albumcontroller-php-L114" rel="file-albumcontroller-php-L114">114</span>
          <span class="line-number" id="file-albumcontroller-php-L115" rel="file-albumcontroller-php-L115">115</span>
          <span class="line-number" id="file-albumcontroller-php-L116" rel="file-albumcontroller-php-L116">116</span>
          <span class="line-number" id="file-albumcontroller-php-L117" rel="file-albumcontroller-php-L117">117</span>
          <span class="line-number" id="file-albumcontroller-php-L118" rel="file-albumcontroller-php-L118">118</span>
          <span class="line-number" id="file-albumcontroller-php-L119" rel="file-albumcontroller-php-L119">119</span>
          <span class="line-number" id="file-albumcontroller-php-L120" rel="file-albumcontroller-php-L120">120</span>
          <span class="line-number" id="file-albumcontroller-php-L121" rel="file-albumcontroller-php-L121">121</span>
          <span class="line-number" id="file-albumcontroller-php-L122" rel="file-albumcontroller-php-L122">122</span>
        </td>
        <td class="line-data">
          <pre class="line-pre"><div class="line" id="file-albumcontroller-php-LC1"><span class="cp">&lt;?php</span></div><div class="line" id="file-albumcontroller-php-LC2">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC3"><span class="k">namespace</span> <span class="nx">Album\Controller</span><span class="p">;</span></div><div class="line" id="file-albumcontroller-php-LC4">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC5"><span class="k">use</span> <span class="nx">Zend\Mvc\Controller\ActionController</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC6">    <span class="nx">Zend\View\Model\ViewModel</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC7">    <span class="nx">Album\Model\AlbumTable</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC8">    <span class="nx">Album\Model\Album</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC9">    <span class="nx">Album\Form\AlbumForm</span><span class="p">;</span></div><div class="line" id="file-albumcontroller-php-LC10">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC11"><span class="k">class</span> <span class="nc">AlbumController</span> <span class="k">extends</span> <span class="nx">ActionController</span></div><div class="line" id="file-albumcontroller-php-LC12"><span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC13">    <span class="sd">/**</span></div><div class="line" id="file-albumcontroller-php-LC14"><span class="sd">     * @var \Album\Model\AlbumTable</span></div><div class="line" id="file-albumcontroller-php-LC15"><span class="sd">     */</span></div><div class="line" id="file-albumcontroller-php-LC16">    <span class="k">protected</span> <span class="nv">$albumTable</span><span class="p">;</span></div><div class="line" id="file-albumcontroller-php-LC17">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC18">    <span class="k">public</span> <span class="k">function</span> <span class="nf">indexAction</span><span class="p">()</span></div><div class="line" id="file-albumcontroller-php-LC19">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC20">        <span class="k">return</span> <span class="k">new</span> <span class="nx">ViewModel</span><span class="p">(</span><span class="k">array</span><span class="p">(</span></div><div class="line" id="file-albumcontroller-php-LC21">            <span class="s1">'albums'</span> <span class="o">=&gt;</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getAlbumTable</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">fetchAll</span><span class="p">(),</span></div><div class="line" id="file-albumcontroller-php-LC22">        <span class="p">));</span></div><div class="line" id="file-albumcontroller-php-LC23">    <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC24">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC25">    <span class="k">public</span> <span class="k">function</span> <span class="nf">addAction</span><span class="p">()</span></div><div class="line" id="file-albumcontroller-php-LC26">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC27">        <span class="nv">$form</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">AlbumForm</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC28">        <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'submit'</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">setAttribute</span><span class="p">(</span><span class="s1">'label'</span><span class="p">,</span> <span class="s1">'Add'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC29">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC30">        <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getRequest</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC31">        <span class="k">if</span> <span class="p">(</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">isPost</span><span class="p">())</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC32">            <span class="nv">$album</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Album</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC33">            <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">setInputFilter</span><span class="p">(</span><span class="nv">$album</span><span class="o">-&gt;</span><span class="na">getInputFilter</span><span class="p">());</span></div><div class="line" id="file-albumcontroller-php-LC34">            <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">setData</span><span class="p">(</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">post</span><span class="p">());</span></div><div class="line" id="file-albumcontroller-php-LC35">            <span class="k">if</span> <span class="p">(</span><span class="nv">$form</span><span class="o">-&gt;</span><span class="na">isValid</span><span class="p">())</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC36">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC37">                <span class="nv">$album</span><span class="o">-&gt;</span><span class="na">populate</span><span class="p">(</span><span class="nv">$form</span><span class="o">-&gt;</span><span class="na">getData</span><span class="p">());</span></div><div class="line" id="file-albumcontroller-php-LC38">                <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getAlbumTable</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">saveAlbum</span><span class="p">(</span><span class="nv">$album</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC39">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC40">                <span class="c1">// Redirect to list of albums</span></div><div class="line" id="file-albumcontroller-php-LC41">                <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">toRoute</span><span class="p">(</span><span class="s1">'album'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC42">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC43">            <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC44">        <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC45">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC46">        <span class="k">return</span> <span class="k">array</span><span class="p">(</span><span class="s1">'form'</span> <span class="o">=&gt;</span> <span class="nv">$form</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC47">    <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC48">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC49">    <span class="k">public</span> <span class="k">function</span> <span class="nf">editAction</span><span class="p">()</span></div><div class="line" id="file-albumcontroller-php-LC50">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC51">        <span class="nv">$id</span> <span class="o">=</span> <span class="p">(</span><span class="nx">int</span><span class="p">)</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEvent</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getRouteMatch</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getParam</span><span class="p">(</span><span class="s1">'id'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC52">        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nv">$id</span><span class="p">)</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC53">            <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">toRoute</span><span class="p">(</span><span class="s1">'album'</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">'action'</span><span class="o">=&gt;</span><span class="s1">'add'</span><span class="p">));</span></div><div class="line" id="file-albumcontroller-php-LC54">        <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC55">        <span class="nv">$album</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getAlbumTable</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getAlbum</span><span class="p">(</span><span class="nv">$id</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC56">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC57">        <span class="nv">$form</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">AlbumForm</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC58">        <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">setBindOnValidate</span><span class="p">(</span><span class="k">false</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC59">        <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">bind</span><span class="p">(</span><span class="nv">$album</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC60">        <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'submit'</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">setAttribute</span><span class="p">(</span><span class="s1">'label'</span><span class="p">,</span> <span class="s1">'Edit'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC61">        </div><div class="line" id="file-albumcontroller-php-LC62">        <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getRequest</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC63">        <span class="k">if</span> <span class="p">(</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">isPost</span><span class="p">())</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC64">            <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">setData</span><span class="p">(</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">post</span><span class="p">());</span></div><div class="line" id="file-albumcontroller-php-LC65">            <span class="k">if</span> <span class="p">(</span><span class="nv">$form</span><span class="o">-&gt;</span><span class="na">isValid</span><span class="p">())</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC66">                <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">bindValues</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC67">                <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getAlbumTable</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">saveAlbum</span><span class="p">(</span><span class="nv">$album</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC68">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC69">                <span class="c1">// Redirect to list of albums</span></div><div class="line" id="file-albumcontroller-php-LC70">                <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">toRoute</span><span class="p">(</span><span class="s1">'album'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC71">            <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC72">        <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC73">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC74">        <span class="k">return</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-albumcontroller-php-LC75">            <span class="s1">'id'</span> <span class="o">=&gt;</span> <span class="nv">$id</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC76">            <span class="s1">'form'</span> <span class="o">=&gt;</span> <span class="nv">$form</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC77">        <span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC78">    <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC79">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC80">    <span class="k">public</span> <span class="k">function</span> <span class="nf">deleteAction</span><span class="p">()</span></div><div class="line" id="file-albumcontroller-php-LC81">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC82">        <span class="nv">$id</span> <span class="o">=</span> <span class="p">(</span><span class="nx">int</span><span class="p">)</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEvent</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getRouteMatch</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getParam</span><span class="p">(</span><span class="s1">'id'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC83">        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nv">$id</span><span class="p">)</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC84">            <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">toRoute</span><span class="p">(</span><span class="s1">'album'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC85">        <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC86">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC87">        <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getRequest</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC88">        <span class="k">if</span> <span class="p">(</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">isPost</span><span class="p">())</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC89">            <span class="nv">$del</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">post</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'del'</span><span class="p">,</span> <span class="s1">'No'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC90">            <span class="k">if</span> <span class="p">(</span><span class="nv">$del</span> <span class="o">==</span> <span class="s1">'Yes'</span><span class="p">)</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC91">                <span class="nv">$id</span> <span class="o">=</span> <span class="p">(</span><span class="nx">int</span><span class="p">)</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">post</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'id'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC92">                <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getAlbumTable</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">deleteAlbum</span><span class="p">(</span><span class="nv">$id</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC93">            <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC94">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC95">            <span class="c1">// Redirect to list of albums</span></div><div class="line" id="file-albumcontroller-php-LC96">            <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">toRoute</span><span class="p">(</span><span class="s1">'default'</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-albumcontroller-php-LC97">                <span class="s1">'controller'</span> <span class="o">=&gt;</span> <span class="s1">'album'</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC98">                <span class="s1">'action'</span>     <span class="o">=&gt;</span> <span class="s1">'index'</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC99">            <span class="p">));</span></div><div class="line" id="file-albumcontroller-php-LC100">        <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC101">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC102">        <span class="k">return</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-albumcontroller-php-LC103">            <span class="s1">'id'</span> <span class="o">=&gt;</span> <span class="nv">$id</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC104">            <span class="s1">'album'</span> <span class="o">=&gt;</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getAlbumTable</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getAlbum</span><span class="p">(</span><span class="nv">$id</span><span class="p">)</span></div><div class="line" id="file-albumcontroller-php-LC105">        <span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC106">    <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC107">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC108">    <span class="k">public</span> <span class="k">function</span> <span class="nf">setAlbumTable</span><span class="p">(</span><span class="nx">AlbumTable</span> <span class="nv">$albumTable</span><span class="p">)</span></div><div class="line" id="file-albumcontroller-php-LC109">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC110">        <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">albumTable</span> <span class="o">=</span> <span class="nv">$albumTable</span><span class="p">;</span></div><div class="line" id="file-albumcontroller-php-LC111">        <span class="k">return</span> <span class="nv">$this</span><span class="p">;</span></div><div class="line" id="file-albumcontroller-php-LC112">    <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC113">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC114">    <span class="k">public</span> <span class="k">function</span> <span class="nf">getAlbumTable</span><span class="p">()</span></div><div class="line" id="file-albumcontroller-php-LC115">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC116">        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">albumTable</span><span class="p">)</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC117">            <span class="nv">$sm</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getServiceLocator</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC118">            <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">albumTable</span> <span class="o">=</span> <span class="nv">$sm</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'album-table'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC119">        <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC120">        <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">albumTable</span><span class="p">;</span></div><div class="line" id="file-albumcontroller-php-LC121">    <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC122"><span class="p">}</span></div></pre>
        </td>
      </tr>
    </tbody></table>
  </div>

        </div>

        <div class="gist-meta">
          <a href="https://gist.github.com/jasongrimes/1698969/raw/81e1912de6786f38b609cb14f685bc1b7df9921f/AlbumController.php" style="float:right">view raw</a>
          <a href="https://gist.github.com/jasongrimes/1698969#file-albumcontroller-php" style="float:right; margin-right:10px; color:#666;">AlbumController.php</a>
          <a href="https://gist.github.com/jasongrimes/1698969">This Gist</a> brought to you by <a href="http://github.com/">GitHub</a>.
        </div>
      </div>
</div>
<p></p>
<p>And here’s my updated version using Doctrine:</p>
<p><script src="Using_Doctrine_2_files/1699014.js"></script><link href="Using_Doctrine_2_files/embed-0af287a4b5c981db301049e56f06e5d3.css" media="screen" rel="stylesheet"></p><div id="gist1699014" class="gist">
      <div class="gist-file">
        <div class="gist-data gist-syntax">



  <div class="file-data">
    <table class="lines highlight" cellpadding="0" cellspacing="0">
      <tbody><tr>
        <td class="line-numbers">
          <span class="line-number" id="file-albumcontroller-php-L1" rel="file-albumcontroller-php-L1">1</span>
          <span class="line-number" id="file-albumcontroller-php-L2" rel="file-albumcontroller-php-L2">2</span>
          <span class="line-number" id="file-albumcontroller-php-L3" rel="file-albumcontroller-php-L3">3</span>
          <span class="line-number" id="file-albumcontroller-php-L4" rel="file-albumcontroller-php-L4">4</span>
          <span class="line-number" id="file-albumcontroller-php-L5" rel="file-albumcontroller-php-L5">5</span>
          <span class="line-number" id="file-albumcontroller-php-L6" rel="file-albumcontroller-php-L6">6</span>
          <span class="line-number" id="file-albumcontroller-php-L7" rel="file-albumcontroller-php-L7">7</span>
          <span class="line-number" id="file-albumcontroller-php-L8" rel="file-albumcontroller-php-L8">8</span>
          <span class="line-number" id="file-albumcontroller-php-L9" rel="file-albumcontroller-php-L9">9</span>
          <span class="line-number" id="file-albumcontroller-php-L10" rel="file-albumcontroller-php-L10">10</span>
          <span class="line-number" id="file-albumcontroller-php-L11" rel="file-albumcontroller-php-L11">11</span>
          <span class="line-number" id="file-albumcontroller-php-L12" rel="file-albumcontroller-php-L12">12</span>
          <span class="line-number" id="file-albumcontroller-php-L13" rel="file-albumcontroller-php-L13">13</span>
          <span class="line-number" id="file-albumcontroller-php-L14" rel="file-albumcontroller-php-L14">14</span>
          <span class="line-number" id="file-albumcontroller-php-L15" rel="file-albumcontroller-php-L15">15</span>
          <span class="line-number" id="file-albumcontroller-php-L16" rel="file-albumcontroller-php-L16">16</span>
          <span class="line-number" id="file-albumcontroller-php-L17" rel="file-albumcontroller-php-L17">17</span>
          <span class="line-number" id="file-albumcontroller-php-L18" rel="file-albumcontroller-php-L18">18</span>
          <span class="line-number" id="file-albumcontroller-php-L19" rel="file-albumcontroller-php-L19">19</span>
          <span class="line-number" id="file-albumcontroller-php-L20" rel="file-albumcontroller-php-L20">20</span>
          <span class="line-number" id="file-albumcontroller-php-L21" rel="file-albumcontroller-php-L21">21</span>
          <span class="line-number" id="file-albumcontroller-php-L22" rel="file-albumcontroller-php-L22">22</span>
          <span class="line-number" id="file-albumcontroller-php-L23" rel="file-albumcontroller-php-L23">23</span>
          <span class="line-number" id="file-albumcontroller-php-L24" rel="file-albumcontroller-php-L24">24</span>
          <span class="line-number" id="file-albumcontroller-php-L25" rel="file-albumcontroller-php-L25">25</span>
          <span class="line-number" id="file-albumcontroller-php-L26" rel="file-albumcontroller-php-L26">26</span>
          <span class="line-number" id="file-albumcontroller-php-L27" rel="file-albumcontroller-php-L27">27</span>
          <span class="line-number" id="file-albumcontroller-php-L28" rel="file-albumcontroller-php-L28">28</span>
          <span class="line-number" id="file-albumcontroller-php-L29" rel="file-albumcontroller-php-L29">29</span>
          <span class="line-number" id="file-albumcontroller-php-L30" rel="file-albumcontroller-php-L30">30</span>
          <span class="line-number" id="file-albumcontroller-php-L31" rel="file-albumcontroller-php-L31">31</span>
          <span class="line-number" id="file-albumcontroller-php-L32" rel="file-albumcontroller-php-L32">32</span>
          <span class="line-number" id="file-albumcontroller-php-L33" rel="file-albumcontroller-php-L33">33</span>
          <span class="line-number" id="file-albumcontroller-php-L34" rel="file-albumcontroller-php-L34">34</span>
          <span class="line-number" id="file-albumcontroller-php-L35" rel="file-albumcontroller-php-L35">35</span>
          <span class="line-number" id="file-albumcontroller-php-L36" rel="file-albumcontroller-php-L36">36</span>
          <span class="line-number" id="file-albumcontroller-php-L37" rel="file-albumcontroller-php-L37">37</span>
          <span class="line-number" id="file-albumcontroller-php-L38" rel="file-albumcontroller-php-L38">38</span>
          <span class="line-number" id="file-albumcontroller-php-L39" rel="file-albumcontroller-php-L39">39</span>
          <span class="line-number" id="file-albumcontroller-php-L40" rel="file-albumcontroller-php-L40">40</span>
          <span class="line-number" id="file-albumcontroller-php-L41" rel="file-albumcontroller-php-L41">41</span>
          <span class="line-number" id="file-albumcontroller-php-L42" rel="file-albumcontroller-php-L42">42</span>
          <span class="line-number" id="file-albumcontroller-php-L43" rel="file-albumcontroller-php-L43">43</span>
          <span class="line-number" id="file-albumcontroller-php-L44" rel="file-albumcontroller-php-L44">44</span>
          <span class="line-number" id="file-albumcontroller-php-L45" rel="file-albumcontroller-php-L45">45</span>
          <span class="line-number" id="file-albumcontroller-php-L46" rel="file-albumcontroller-php-L46">46</span>
          <span class="line-number" id="file-albumcontroller-php-L47" rel="file-albumcontroller-php-L47">47</span>
          <span class="line-number" id="file-albumcontroller-php-L48" rel="file-albumcontroller-php-L48">48</span>
          <span class="line-number" id="file-albumcontroller-php-L49" rel="file-albumcontroller-php-L49">49</span>
          <span class="line-number" id="file-albumcontroller-php-L50" rel="file-albumcontroller-php-L50">50</span>
          <span class="line-number" id="file-albumcontroller-php-L51" rel="file-albumcontroller-php-L51">51</span>
          <span class="line-number" id="file-albumcontroller-php-L52" rel="file-albumcontroller-php-L52">52</span>
          <span class="line-number" id="file-albumcontroller-php-L53" rel="file-albumcontroller-php-L53">53</span>
          <span class="line-number" id="file-albumcontroller-php-L54" rel="file-albumcontroller-php-L54">54</span>
          <span class="line-number" id="file-albumcontroller-php-L55" rel="file-albumcontroller-php-L55">55</span>
          <span class="line-number" id="file-albumcontroller-php-L56" rel="file-albumcontroller-php-L56">56</span>
          <span class="line-number" id="file-albumcontroller-php-L57" rel="file-albumcontroller-php-L57">57</span>
          <span class="line-number" id="file-albumcontroller-php-L58" rel="file-albumcontroller-php-L58">58</span>
          <span class="line-number" id="file-albumcontroller-php-L59" rel="file-albumcontroller-php-L59">59</span>
          <span class="line-number" id="file-albumcontroller-php-L60" rel="file-albumcontroller-php-L60">60</span>
          <span class="line-number" id="file-albumcontroller-php-L61" rel="file-albumcontroller-php-L61">61</span>
          <span class="line-number" id="file-albumcontroller-php-L62" rel="file-albumcontroller-php-L62">62</span>
          <span class="line-number" id="file-albumcontroller-php-L63" rel="file-albumcontroller-php-L63">63</span>
          <span class="line-number" id="file-albumcontroller-php-L64" rel="file-albumcontroller-php-L64">64</span>
          <span class="line-number" id="file-albumcontroller-php-L65" rel="file-albumcontroller-php-L65">65</span>
          <span class="line-number" id="file-albumcontroller-php-L66" rel="file-albumcontroller-php-L66">66</span>
          <span class="line-number" id="file-albumcontroller-php-L67" rel="file-albumcontroller-php-L67">67</span>
          <span class="line-number" id="file-albumcontroller-php-L68" rel="file-albumcontroller-php-L68">68</span>
          <span class="line-number" id="file-albumcontroller-php-L69" rel="file-albumcontroller-php-L69">69</span>
          <span class="line-number" id="file-albumcontroller-php-L70" rel="file-albumcontroller-php-L70">70</span>
          <span class="line-number" id="file-albumcontroller-php-L71" rel="file-albumcontroller-php-L71">71</span>
          <span class="line-number" id="file-albumcontroller-php-L72" rel="file-albumcontroller-php-L72">72</span>
          <span class="line-number" id="file-albumcontroller-php-L73" rel="file-albumcontroller-php-L73">73</span>
          <span class="line-number" id="file-albumcontroller-php-L74" rel="file-albumcontroller-php-L74">74</span>
          <span class="line-number" id="file-albumcontroller-php-L75" rel="file-albumcontroller-php-L75">75</span>
          <span class="line-number" id="file-albumcontroller-php-L76" rel="file-albumcontroller-php-L76">76</span>
          <span class="line-number" id="file-albumcontroller-php-L77" rel="file-albumcontroller-php-L77">77</span>
          <span class="line-number" id="file-albumcontroller-php-L78" rel="file-albumcontroller-php-L78">78</span>
          <span class="line-number" id="file-albumcontroller-php-L79" rel="file-albumcontroller-php-L79">79</span>
          <span class="line-number" id="file-albumcontroller-php-L80" rel="file-albumcontroller-php-L80">80</span>
          <span class="line-number" id="file-albumcontroller-php-L81" rel="file-albumcontroller-php-L81">81</span>
          <span class="line-number" id="file-albumcontroller-php-L82" rel="file-albumcontroller-php-L82">82</span>
          <span class="line-number" id="file-albumcontroller-php-L83" rel="file-albumcontroller-php-L83">83</span>
          <span class="line-number" id="file-albumcontroller-php-L84" rel="file-albumcontroller-php-L84">84</span>
          <span class="line-number" id="file-albumcontroller-php-L85" rel="file-albumcontroller-php-L85">85</span>
          <span class="line-number" id="file-albumcontroller-php-L86" rel="file-albumcontroller-php-L86">86</span>
          <span class="line-number" id="file-albumcontroller-php-L87" rel="file-albumcontroller-php-L87">87</span>
          <span class="line-number" id="file-albumcontroller-php-L88" rel="file-albumcontroller-php-L88">88</span>
          <span class="line-number" id="file-albumcontroller-php-L89" rel="file-albumcontroller-php-L89">89</span>
          <span class="line-number" id="file-albumcontroller-php-L90" rel="file-albumcontroller-php-L90">90</span>
          <span class="line-number" id="file-albumcontroller-php-L91" rel="file-albumcontroller-php-L91">91</span>
          <span class="line-number" id="file-albumcontroller-php-L92" rel="file-albumcontroller-php-L92">92</span>
          <span class="line-number" id="file-albumcontroller-php-L93" rel="file-albumcontroller-php-L93">93</span>
          <span class="line-number" id="file-albumcontroller-php-L94" rel="file-albumcontroller-php-L94">94</span>
          <span class="line-number" id="file-albumcontroller-php-L95" rel="file-albumcontroller-php-L95">95</span>
          <span class="line-number" id="file-albumcontroller-php-L96" rel="file-albumcontroller-php-L96">96</span>
          <span class="line-number" id="file-albumcontroller-php-L97" rel="file-albumcontroller-php-L97">97</span>
          <span class="line-number" id="file-albumcontroller-php-L98" rel="file-albumcontroller-php-L98">98</span>
          <span class="line-number" id="file-albumcontroller-php-L99" rel="file-albumcontroller-php-L99">99</span>
          <span class="line-number" id="file-albumcontroller-php-L100" rel="file-albumcontroller-php-L100">100</span>
          <span class="line-number" id="file-albumcontroller-php-L101" rel="file-albumcontroller-php-L101">101</span>
          <span class="line-number" id="file-albumcontroller-php-L102" rel="file-albumcontroller-php-L102">102</span>
          <span class="line-number" id="file-albumcontroller-php-L103" rel="file-albumcontroller-php-L103">103</span>
          <span class="line-number" id="file-albumcontroller-php-L104" rel="file-albumcontroller-php-L104">104</span>
          <span class="line-number" id="file-albumcontroller-php-L105" rel="file-albumcontroller-php-L105">105</span>
          <span class="line-number" id="file-albumcontroller-php-L106" rel="file-albumcontroller-php-L106">106</span>
          <span class="line-number" id="file-albumcontroller-php-L107" rel="file-albumcontroller-php-L107">107</span>
          <span class="line-number" id="file-albumcontroller-php-L108" rel="file-albumcontroller-php-L108">108</span>
          <span class="line-number" id="file-albumcontroller-php-L109" rel="file-albumcontroller-php-L109">109</span>
          <span class="line-number" id="file-albumcontroller-php-L110" rel="file-albumcontroller-php-L110">110</span>
          <span class="line-number" id="file-albumcontroller-php-L111" rel="file-albumcontroller-php-L111">111</span>
          <span class="line-number" id="file-albumcontroller-php-L112" rel="file-albumcontroller-php-L112">112</span>
          <span class="line-number" id="file-albumcontroller-php-L113" rel="file-albumcontroller-php-L113">113</span>
          <span class="line-number" id="file-albumcontroller-php-L114" rel="file-albumcontroller-php-L114">114</span>
          <span class="line-number" id="file-albumcontroller-php-L115" rel="file-albumcontroller-php-L115">115</span>
          <span class="line-number" id="file-albumcontroller-php-L116" rel="file-albumcontroller-php-L116">116</span>
          <span class="line-number" id="file-albumcontroller-php-L117" rel="file-albumcontroller-php-L117">117</span>
          <span class="line-number" id="file-albumcontroller-php-L118" rel="file-albumcontroller-php-L118">118</span>
          <span class="line-number" id="file-albumcontroller-php-L119" rel="file-albumcontroller-php-L119">119</span>
          <span class="line-number" id="file-albumcontroller-php-L120" rel="file-albumcontroller-php-L120">120</span>
          <span class="line-number" id="file-albumcontroller-php-L121" rel="file-albumcontroller-php-L121">121</span>
          <span class="line-number" id="file-albumcontroller-php-L122" rel="file-albumcontroller-php-L122">122</span>
          <span class="line-number" id="file-albumcontroller-php-L123" rel="file-albumcontroller-php-L123">123</span>
          <span class="line-number" id="file-albumcontroller-php-L124" rel="file-albumcontroller-php-L124">124</span>
        </td>
        <td class="line-data">
          <pre class="line-pre"><div class="line" id="file-albumcontroller-php-LC1"><span class="cp">&lt;?php</span></div><div class="line" id="file-albumcontroller-php-LC2">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC3"><span class="k">namespace</span> <span class="nx">Album\Controller</span><span class="p">;</span></div><div class="line" id="file-albumcontroller-php-LC4">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC5"><span class="k">use</span> <span class="nx">Zend\Mvc\Controller\ActionController</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC6">    <span class="nx">Zend\View\Model\ViewModel</span><span class="p">,</span> </div><div class="line" id="file-albumcontroller-php-LC7">    <span class="nx">Album\Form\AlbumForm</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC8">    <span class="nx">Doctrine\ORM\EntityManager</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC9">    <span class="nx">Album\Entity\Album</span><span class="p">;</span></div><div class="line" id="file-albumcontroller-php-LC10">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC11"><span class="k">class</span> <span class="nc">AlbumController</span> <span class="k">extends</span> <span class="nx">ActionController</span></div><div class="line" id="file-albumcontroller-php-LC12"><span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC13">    <span class="sd">/**</span></div><div class="line" id="file-albumcontroller-php-LC14"><span class="sd">     * @var Doctrine\ORM\EntityManager</span></div><div class="line" id="file-albumcontroller-php-LC15"><span class="sd">     */</span></div><div class="line" id="file-albumcontroller-php-LC16">    <span class="k">protected</span> <span class="nv">$em</span><span class="p">;</span></div><div class="line" id="file-albumcontroller-php-LC17">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC18">    <span class="k">public</span> <span class="k">function</span> <span class="nf">setEntityManager</span><span class="p">(</span><span class="nx">EntityManager</span> <span class="nv">$em</span><span class="p">)</span></div><div class="line" id="file-albumcontroller-php-LC19">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC20">        <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">em</span> <span class="o">=</span> <span class="nv">$em</span><span class="p">;</span></div><div class="line" id="file-albumcontroller-php-LC21">    <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC22"> </div><div class="line" id="file-albumcontroller-php-LC23">    <span class="k">public</span> <span class="k">function</span> <span class="nf">getEntityManager</span><span class="p">()</span></div><div class="line" id="file-albumcontroller-php-LC24">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC25">        <span class="k">if</span> <span class="p">(</span><span class="k">null</span> <span class="o">===</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">em</span><span class="p">)</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC26">            <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">em</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getServiceLocator</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'Doctrine\ORM\EntityManager'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC27">        <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC28">        <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">em</span><span class="p">;</span></div><div class="line" id="file-albumcontroller-php-LC29">    <span class="p">}</span> </div><div class="line" id="file-albumcontroller-php-LC30">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC31">    <span class="k">public</span> <span class="k">function</span> <span class="nf">indexAction</span><span class="p">()</span></div><div class="line" id="file-albumcontroller-php-LC32">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC33">        <span class="k">return</span> <span class="k">new</span> <span class="nx">ViewModel</span><span class="p">(</span><span class="k">array</span><span class="p">(</span></div><div class="line" id="file-albumcontroller-php-LC34">            <span class="s1">'albums'</span> <span class="o">=&gt;</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEntityManager</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getRepository</span><span class="p">(</span><span class="s1">'Album\Entity\Album'</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">findAll</span><span class="p">()</span> </div><div class="line" id="file-albumcontroller-php-LC35">        <span class="p">));</span></div><div class="line" id="file-albumcontroller-php-LC36">    <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC37">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC38">    <span class="k">public</span> <span class="k">function</span> <span class="nf">addAction</span><span class="p">()</span></div><div class="line" id="file-albumcontroller-php-LC39">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC40">        <span class="nv">$form</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">AlbumForm</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC41">        <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'submit'</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">setAttribute</span><span class="p">(</span><span class="s1">'label'</span><span class="p">,</span> <span class="s1">'Add'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC42">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC43">        <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getRequest</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC44">        <span class="k">if</span> <span class="p">(</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">isPost</span><span class="p">())</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC45">            <span class="nv">$album</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Album</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC46">            </div><div class="line" id="file-albumcontroller-php-LC47">            <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">setInputFilter</span><span class="p">(</span><span class="nv">$album</span><span class="o">-&gt;</span><span class="na">getInputFilter</span><span class="p">());</span></div><div class="line" id="file-albumcontroller-php-LC48">            <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">setData</span><span class="p">(</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">post</span><span class="p">());</span></div><div class="line" id="file-albumcontroller-php-LC49">            <span class="k">if</span> <span class="p">(</span><span class="nv">$form</span><span class="o">-&gt;</span><span class="na">isValid</span><span class="p">())</span> <span class="p">{</span> </div><div class="line" id="file-albumcontroller-php-LC50">                <span class="nv">$album</span><span class="o">-&gt;</span><span class="na">populate</span><span class="p">(</span><span class="nv">$form</span><span class="o">-&gt;</span><span class="na">getData</span><span class="p">());</span> </div><div class="line" id="file-albumcontroller-php-LC51">                <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEntityManager</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">persist</span><span class="p">(</span><span class="nv">$album</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC52">                <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEntityManager</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">flush</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC53">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC54">                <span class="c1">// Redirect to list of albums</span></div><div class="line" id="file-albumcontroller-php-LC55">                <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">toRoute</span><span class="p">(</span><span class="s1">'album'</span><span class="p">);</span> </div><div class="line" id="file-albumcontroller-php-LC56">            <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC57">        <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC58">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC59">        <span class="k">return</span> <span class="k">array</span><span class="p">(</span><span class="s1">'form'</span> <span class="o">=&gt;</span> <span class="nv">$form</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC60">    <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC61">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC62">    <span class="k">public</span> <span class="k">function</span> <span class="nf">editAction</span><span class="p">()</span></div><div class="line" id="file-albumcontroller-php-LC63">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC64">        <span class="nv">$id</span> <span class="o">=</span> <span class="p">(</span><span class="nx">int</span><span class="p">)</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEvent</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getRouteMatch</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getParam</span><span class="p">(</span><span class="s1">'id'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC65">        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nv">$id</span><span class="p">)</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC66">            <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">toRoute</span><span class="p">(</span><span class="s1">'album'</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">'action'</span><span class="o">=&gt;</span><span class="s1">'add'</span><span class="p">));</span></div><div class="line" id="file-albumcontroller-php-LC67">        <span class="p">}</span> </div><div class="line" id="file-albumcontroller-php-LC68">        <span class="nv">$album</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEntityManager</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">find</span><span class="p">(</span><span class="s1">'Album\Entity\Album'</span><span class="p">,</span> <span class="nv">$id</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC69">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC70">        <span class="nv">$form</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">AlbumForm</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC71">        <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">setBindOnValidate</span><span class="p">(</span><span class="k">false</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC72">        <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">bind</span><span class="p">(</span><span class="nv">$album</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC73">        <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'submit'</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">setAttribute</span><span class="p">(</span><span class="s1">'label'</span><span class="p">,</span> <span class="s1">'Edit'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC74">        </div><div class="line" id="file-albumcontroller-php-LC75">        <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getRequest</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC76">        <span class="k">if</span> <span class="p">(</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">isPost</span><span class="p">())</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC77">            <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">setData</span><span class="p">(</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">post</span><span class="p">());</span></div><div class="line" id="file-albumcontroller-php-LC78">            <span class="k">if</span> <span class="p">(</span><span class="nv">$form</span><span class="o">-&gt;</span><span class="na">isValid</span><span class="p">())</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC79">                <span class="nv">$form</span><span class="o">-&gt;</span><span class="na">bindValues</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC80">                <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEntityManager</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">flush</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC81">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC82">                <span class="c1">// Redirect to list of albums</span></div><div class="line" id="file-albumcontroller-php-LC83">                <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">toRoute</span><span class="p">(</span><span class="s1">'album'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC84">            <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC85">        <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC86">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC87">        <span class="k">return</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-albumcontroller-php-LC88">            <span class="s1">'id'</span> <span class="o">=&gt;</span> <span class="nv">$id</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC89">            <span class="s1">'form'</span> <span class="o">=&gt;</span> <span class="nv">$form</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC90">        <span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC91">    <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC92">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC93">    <span class="k">public</span> <span class="k">function</span> <span class="nf">deleteAction</span><span class="p">()</span></div><div class="line" id="file-albumcontroller-php-LC94">    <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC95">        <span class="nv">$id</span> <span class="o">=</span> <span class="p">(</span><span class="nx">int</span><span class="p">)</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEvent</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getRouteMatch</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getParam</span><span class="p">(</span><span class="s1">'id'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC96">        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nv">$id</span><span class="p">)</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC97">            <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">toRoute</span><span class="p">(</span><span class="s1">'album'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC98">        <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC99">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC100">        <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getRequest</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC101">        <span class="k">if</span> <span class="p">(</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">isPost</span><span class="p">())</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC102">            <span class="nv">$del</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">post</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'del'</span><span class="p">,</span> <span class="s1">'No'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC103">            <span class="k">if</span> <span class="p">(</span><span class="nv">$del</span> <span class="o">==</span> <span class="s1">'Yes'</span><span class="p">)</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC104">                <span class="nv">$id</span> <span class="o">=</span> <span class="p">(</span><span class="nx">int</span><span class="p">)</span><span class="nv">$request</span><span class="o">-&gt;</span><span class="na">post</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'id'</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC105">                <span class="nv">$album</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEntityManager</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">find</span><span class="p">(</span><span class="s1">'Album\Entity\Album'</span><span class="p">,</span> <span class="nv">$id</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC106">                <span class="k">if</span> <span class="p">(</span><span class="nv">$album</span><span class="p">)</span> <span class="p">{</span></div><div class="line" id="file-albumcontroller-php-LC107">                    <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEntityManager</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">remove</span><span class="p">(</span><span class="nv">$album</span><span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC108">                    <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEntityManager</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">flush</span><span class="p">();</span></div><div class="line" id="file-albumcontroller-php-LC109">                <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC110">            <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC111">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC112">            <span class="c1">// Redirect to list of albums</span></div><div class="line" id="file-albumcontroller-php-LC113">            <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">toRoute</span><span class="p">(</span><span class="s1">'default'</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-albumcontroller-php-LC114">                <span class="s1">'controller'</span> <span class="o">=&gt;</span> <span class="s1">'album'</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC115">                <span class="s1">'action'</span>     <span class="o">=&gt;</span> <span class="s1">'index'</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC116">            <span class="p">));</span></div><div class="line" id="file-albumcontroller-php-LC117">        <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC118">&nbsp;</div><div class="line" id="file-albumcontroller-php-LC119">        <span class="k">return</span> <span class="k">array</span><span class="p">(</span></div><div class="line" id="file-albumcontroller-php-LC120">            <span class="s1">'id'</span> <span class="o">=&gt;</span> <span class="nv">$id</span><span class="p">,</span></div><div class="line" id="file-albumcontroller-php-LC121">            <span class="s1">'album'</span> <span class="o">=&gt;</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getEntityManager</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">find</span><span class="p">(</span><span class="s1">'Album\Entity\Album'</span><span class="p">,</span> <span class="nv">$id</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">getArrayCopy</span><span class="p">()</span></div><div class="line" id="file-albumcontroller-php-LC122">        <span class="p">);</span></div><div class="line" id="file-albumcontroller-php-LC123">    <span class="p">}</span></div><div class="line" id="file-albumcontroller-php-LC124"><span class="p">}</span></div></pre>
        </td>
      </tr>
    </tbody></table>
  </div>

        </div>

        <div class="gist-meta">
          <a href="https://gist.github.com/jasongrimes/1699014/raw/27fe6e78bdfc6ce40c0bc0f04e87fad7ec9b447a/AlbumController.php" style="float:right">view raw</a>
          <a href="https://gist.github.com/jasongrimes/1699014#file-albumcontroller-php" style="float:right; margin-right:10px; color:#666;">AlbumController.php</a>
          <a href="https://gist.github.com/jasongrimes/1699014">This Gist</a> brought to you by <a href="http://github.com/">GitHub</a>.
        </div>
      </div>
</div>
<p></p>
<h2>That’s it!</h2>
<p>That’s all there is to it. Thanks to Akrabat for the helpful tutorial, and to all the developers whose work makes this possible.</p>
					</div><!-- END entry -->
		<div class="add-info">
					</div>
		<div class="post-info-bottom">
			<span class="post-info-category"><a href="http://www.jasongrimes.org/category/development/" title="View all posts in Software Development" rel="category tag">Software Development</a></span><span class="post-info-tags"><a href="http://www.jasongrimes.org/tag/composer/" rel="tag">composer</a>, <a href="http://www.jasongrimes.org/tag/doctrine2/" rel="tag">doctrine2</a>, <a href="http://www.jasongrimes.org/tag/php/" rel="tag">php</a>, <a href="http://www.jasongrimes.org/tag/zf2/" rel="tag">zf2</a></span>
		</div>
		<div id="nav-below">
			<div class="nav-previous"><a href="http://www.jasongrimes.org/2012/01/using-apache-ivy-to-manage-directory-dependencies-in-non-java-projects/" rel="prev"><span class="meta-nav">←</span> Using Apache Ivy to manage directory dependencies in non-Java projects</a></div>
			<div class="nav-next"><a href="http://www.jasongrimes.org/2012/06/managing-lamp-environments-with-chef-vagrant-and-ec2-1-of-3/" rel="next">Managing LAMP environments with Chef, Vagrant, and EC2 (1 of 3) <span class="meta-nav">→</span></a></div>
		</div><!-- #nav-below -->					
	</div><!-- END post -->
	<!-- You can start editing here. -->

			<div id="comments-div"><span id="comments-addcomment"><a href="#respond" rel="nofollow" title="Leave a comment ?">Leave a comment ?</a></span><h2 id="comments">172 Comments.</h2></div>
		<ol class="commentlist" id="thecomments">
				
<li class="comment even thread-even depth-1" id="li-comment-701">
	<div id="comment-701">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/3cf7a8ab0bccee5b65d39b50a170a555.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://marco-pivetta.com/" rel="external nofollow" class="url">Marco Pivetta</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-701">January 29, 2012 at 3:19 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Thumbs up for this! I should write something similar for other Doctrine-related projects <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley"> </p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=701#respond" onclick='return addComment.moveForm("comment-701", "701", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor odd alt depth-2" id="li-comment-705">
	<div id="comment-705">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Jason</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-705">January 30, 2012 at 2:49 am</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks, Marco! I’ve been looking at your ZfDoctrineMigrations module in particular; I hope to get a chance to try that out soon.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=705#respond" onclick='return addComment.moveForm("comment-705", "705", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-3" id="li-comment-2631">
	<div id="comment-2631">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/3cf7a8ab0bccee5b65d39b50a170a555.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://marco-pivetta.com/" rel="external nofollow" class="url">Marco Pivetta</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2631">May 13, 2012 at 10:02 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hey Jason!<br>
Could you update your tutorial with the new installation method? This 
article is currently causing some issues (literally, people open issues 
on the github tracker <img src="Using_Doctrine_2_files/icon_razz.gif" alt=":P" class="wp-smiley"> ).<br>
I’ve explained how to do this at <a href="https://github.com/doctrine/DoctrineModule/blob/master/README.md" rel="nofollow">https://github.com/doctrine/DoctrineModule/blob/master/README.md</a> <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley"> </p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2631#respond" onclick='return addComment.moveForm("comment-2631", "2631", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor odd alt depth-4" id="li-comment-2643">
	<div id="comment-2643">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2643">May 14, 2012 at 1:21 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Marco,</p>
<p>Thanks for letting me know. I’ll add a quick note at the top for now until I get a chance to update the body of the article.</p>
<p>That is just awesome that Doctrine installs with composer now. Great job on that.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2643#respond" onclick='return addComment.moveForm("comment-2643", "2643", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-714">
	<div id="comment-714">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/f3802a18d711d9305b2e818b33a9430f.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">M Jehanzeb</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-714">January 31, 2012 at 4:56 am</a></span>
		</div>
		<div class="comment-text">
			<p>Great article and was fun to setup.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=714#respond" onclick='return addComment.moveForm("comment-714", "714", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-715">
	<div id="comment-715">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d6059b29a89bcde19eec5f64dd0c31ca.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jaijaz.co.nz/blog/" rel="external nofollow" class="url">Jai Ivarsson</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-715">January 31, 2012 at 7:23 am</a></span>
		</div>
		<div class="comment-text">
			<p>Great tutorial. If only I’d this a month ago when I did my <a href="http://www.jaijaz.co.nz/blog/1004/hackathon-zend-framework-2-with-doctrine-2/" rel="nofollow">New Years Day Hackathon</a>.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=715#respond" onclick='return addComment.moveForm("comment-715", "715", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="pingback even thread-odd thread-alt depth-1" id="li-comment-716">
	<div id="comment-716">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://links.davidesalerno.net/2012/01/using-doctrine-2-in-zend-framework-2-the-blog-of-jason-grimes/" rel="external nofollow" class="url">Using Doctrine 2 in Zend Framework 2 | The Blog of Jason Grimes | Links di Davide Salerno</a> - pingback on January 31, 2012 at 12:38 pm</cite>
		</div>
	</div>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-738">
	<div id="comment-738">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/de7419f3be101430400f2c9d26f4d122.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Mike</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-738">February 2, 2012 at 12:11 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Very very good tutorial! I hope you’ll post something about auth + acl soon =)<br>
Thanks a lot.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=738#respond" onclick='return addComment.moveForm("comment-738", "738", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-775">
	<div id="comment-775">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/52f18d50fc841a7ad833481b85a0e79f.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Bill</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-775">February 7, 2012 at 3:09 pm</a></span>
		</div>
		<div class="comment-text">
			<p>For us who don’t use git, don’t forget to download all dependencies for Doctrine.<br>
<a href="https://github.com/doctrine/doctrine-build-common" rel="nofollow">https://github.com/doctrine/doctrine-build-common</a><br>
<a href="https://github.com/doctrine/common" rel="nofollow">https://github.com/doctrine/common</a><br>
<a href="https://github.com/doctrine/dbal" rel="nofollow">https://github.com/doctrine/dbal</a><br>
<a href="https://github.com/symfony/Console" rel="nofollow">https://github.com/symfony/Console</a><br>
<a href="https://github.com/symfony/Yaml" rel="nofollow">https://github.com/symfony/Yaml</a></p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=775#respond" onclick='return addComment.moveForm("comment-775", "775", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-2" id="li-comment-810">
	<div id="comment-810">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/54dd86c0bb3738c59590a7011de29d1b.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://paveldubinin.com/" rel="external nofollow" class="url">Pavel Dubinin</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-810">February 11, 2012 at 5:15 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I do not see why not using git. I think it worth spending some 
time configuring it once and then it will be much easier to work with 
the code.</p>
<p>For instance, as Zend2 is on beta, these modules are updated all the 
time and you’ll have to redownload those again and again. When using git
 you can just pull them with one command.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=810#respond" onclick='return addComment.moveForm("comment-810", "810", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-3" id="li-comment-9250">
	<div id="comment-9250">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/a7a80d44b44b87d562e7b84ed0c5d328.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Catalin</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-9250">November 11, 2012 at 12:34 pm</a></span>
		</div>
		<div class="comment-text">
			<p>config it like “apt-get install git-core”? eh.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=9250#respond" onclick='return addComment.moveForm("comment-9250", "9250", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>
</ul>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-776">
	<div id="comment-776">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/07d9e936fca06d6d738f674bd2ef2378.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://mhf.ir/" rel="external nofollow" class="url">Muhmmad</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-776">February 7, 2012 at 6:53 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Very good article we wait for it. Cheeeersss!!! ~0)</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=776#respond" onclick='return addComment.moveForm("comment-776", "776", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-798">
	<div id="comment-798">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/54dd86c0bb3738c59590a7011de29d1b.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://paveldubinin.com/" rel="external nofollow" class="url">Pavel Dubinin</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-798">February 10, 2012 at 10:45 am</a></span>
		</div>
		<div class="comment-text">
			<p>Thank you for a very nice article.<br>
I have one problem though, I spent too much time trying to make it work in modular way.</p>
<p>I described my module like you proposed at 
$PROJECT_DIR/module/Album/config/module.config.php. But when calling 
doctrine from command line it just says “No Metadata Classes to process”</p>
<p>Paths are ok, entites are fine. When I tested them under Application/Entity with global config everything worked fine. </p>
<p>Hope you can help. Thanks in advance.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=798#respond" onclick='return addComment.moveForm("comment-798", "798", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor odd alt depth-2" id="li-comment-800">
	<div id="comment-800">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Jason</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-800">February 10, 2012 at 2:06 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Pavel,</p>
<p>Did you create the 
$PROJECT_DIR/module/Application/src/Application/Entity directory? Even 
though there’s nothing in it, I remember getting an error from the 
doctrine command line tool when that directory didn’t exist.</p>
<p>Jason</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=800#respond" onclick='return addComment.moveForm("comment-800", "800", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-3" id="li-comment-801">
	<div id="comment-801">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/54dd86c0bb3738c59590a7011de29d1b.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://paveldubinin.com/" rel="external nofollow" class="url">Pavel Dubinin</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-801">February 10, 2012 at 2:29 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Yes, I have a real module there, without a module it throws an exception.</p>
<p>Jason, would that be hard for you to send me the entire project for 
this article please (maybe without any vendors)? That would be easier to
 spot the problem.</p>
<p>Thanks</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=801#respond" onclick='return addComment.moveForm("comment-801", "801", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor odd alt depth-4" id="li-comment-808">
	<div id="comment-808">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-808">February 11, 2012 at 2:19 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Pavel,</p>
<p>Sure, no problem. I created a repository for it at Github: <a href="https://github.com/jasongrimes/zf2tutorial" rel="nofollow">https://github.com/jasongrimes/zf2tutorial</a> </p>
<p>Hope this helps.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=808#respond" onclick='return addComment.moveForm("comment-808", "808", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-5" id="li-comment-809">
	<div id="comment-809">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/54dd86c0bb3738c59590a7011de29d1b.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://paveldubinin.com/" rel="external nofollow" class="url">Pavel Dubinin</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-809">February 11, 2012 at 4:59 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks, that helped alot. It happens that I just misplaced “)” at the config <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley"> </p>
					</div>
		<div class="reply">
					</div>
	</div>

</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>

<li class="comment odd alt depth-2" id="li-comment-2641">
	<div id="comment-2641">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/95436d3e785cb7553de3bc588df14c20.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.inthemix.ir/" rel="external nofollow" class="url">sina miandashti</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2641">May 14, 2012 at 12:18 pm</a></span>
		</div>
		<div class="comment-text">
			<p>i got this error today</p>
<p>fix : check that u put doctrineormmodule config file in application autoload config folder</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2641#respond" onclick='return addComment.moveForm("comment-2641", "2641", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>

<li class="comment even thread-even depth-1" id="li-comment-824">
	<div id="comment-824">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/35a45059718f9fcd7255860e16e345d2.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Thomas Boland</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-824">February 13, 2012 at 3:54 pm</a></span>
		</div>
		<div class="comment-text">
			<p>First of all thanks for the great tutorial! (Also some big thanks 
for Akrabat!) Being kind of new to MVC a lot of questions are coming to 
my mind. The most prominent question is how I should expand this 
application. </p>
<p>Let’s say I also want Artist and Genre entities; should I create new 
modules (/module/Artist and /module/Genre) or should I rename the Album 
module to MediaLibrary (or any other name of choice) and create new 
entities for Artist and Genre (/module/Album/src/Entity/Artist 
/module/Album/src/Entity/Genre)</p>
<p>What’s the best practice?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=824#respond" onclick='return addComment.moveForm("comment-824", "824", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-2" id="li-comment-863">
	<div id="comment-863">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/35a45059718f9fcd7255860e16e345d2.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Thomas Boland</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-863">February 17, 2012 at 6:57 pm</a></span>
		</div>
		<div class="comment-text">
			<p>To answer my own question: this link: <a href="http://mwop.net/blog/267-Getting-started-writing-ZF2-modules" rel="nofollow">http://mwop.net/blog/267-Getting-started-writing-ZF2-modules</a>
 explains how modules should be used. So it is best to rename my Album 
module to something like MediaLibrary and declare other entities in 
there, next to my Album entity.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=863#respond" onclick='return addComment.moveForm("comment-863", "863", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-827">
	<div id="comment-827">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/afdec73815bf54019f1872348923316f.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">wperle</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-827">February 13, 2012 at 6:22 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks for this tuto, plz can you tel me where put exactly this instance array in  AlbumController’s configuration<br>
<code><br>
'Album\Controller\AlbumController' =&gt; array(<br>
    'parameters' =&gt; array(<br>
        // 'albumTable' =&gt; 'Album\Model\AlbumTable',<br>
        'em' =&gt; 'doctrine_em',<br>
    ),<br>
),<br>
</code></p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=827#respond" onclick='return addComment.moveForm("comment-827", "827", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor odd alt depth-2" id="li-comment-2501">
	<div id="comment-2501">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2501">May 3, 2012 at 2:19 am</a></span>
		</div>
		<div class="comment-text">
			<p>I pasted the complete module.config.php file here so you can see it in context: <a href="https://gist.github.com/2582576" rel="nofollow">https://gist.github.com/2582576</a></p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2501#respond" onclick='return addComment.moveForm("comment-2501", "2501", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>

<li class="comment even thread-even depth-1" id="li-comment-855">
	<div id="comment-855">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/c48c5568932046fed6de46fe5a587f42.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Mofdi</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-855">February 16, 2012 at 10:33 pm</a></span>
		</div>
		<div class="comment-text">
			<p>i have this fatal error:<br>
Fatal error: Uncaught exception ‘ReflectionException’ with message 
‘Class Doctrine\ORM\EntityManager does not exist’ in 
C:\wamp\www\zf2-tutorial\vendor\ZendFramework\library\Zend\Code\Reflection\ParameterReflection.php
 on line 66</p>
<p>Can you help me thx</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=855#respond" onclick='return addComment.moveForm("comment-855", "855", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-890">
	<div id="comment-890">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/c90001473b4c35d72dd440d66d22bad7.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">alberto</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-890">February 20, 2012 at 1:29 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Very interesting article Jason! I’m tryng to implement on my dev 
pc, but I have a Fatal error.. Class 
‘Doctrine\ORM\Mapping\DefaultNamingStrategy’ not found in .. 
\www\tavole\vendor\DoctrineORMModule\vendor\doctrine-orm\lib\Doctrine\ORM\Configuration.php
 on line 574. The akrabat tutorial works fine.. some suggestions?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=890#respond" onclick='return addComment.moveForm("comment-890", "890", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-2" id="li-comment-908">
	<div id="comment-908">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/c90001473b4c35d72dd440d66d22bad7.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">alberto</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-908">February 21, 2012 at 12:26 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I don’t know if this is the right solution.. but adding 
namingsytrategy and defaultnamingstrategy entries to autoload_classmap 
solved the problem..</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=908#respond" onclick='return addComment.moveForm("comment-908", "908", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-893">
	<div id="comment-893">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/7df12451121b3fce724a64ea099e7d31.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">pejot</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-893">February 20, 2012 at 2:30 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi,</p>
<p>shouldn’t you persist the album entity after editing and before flushing?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=893#respond" onclick='return addComment.moveForm("comment-893", "893", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-909">
	<div id="comment-909">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/64b522af30edf535465dce02110f21f6.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://techiesindiainc.com/" rel="external nofollow" class="url">Zend Framework</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-909">February 21, 2012 at 12:34 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Didn’t used Doctrine 2 in Zend framework before, possibly going to start now. Must appreciate your Zend Knowledge.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=909#respond" onclick='return addComment.moveForm("comment-909", "909", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="pingback odd alt thread-even depth-1" id="li-comment-970">
	<div id="comment-970">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://codeperl.wordpress.com/2012/02/25/doctrine-and-zend-framework-integration/" rel="external nofollow" class="url">Doctrine and Zend Framework integration « Codeperl's Knowledge Sharing System</a> - pingback on February 25, 2012 at 6:36 am</cite>
		</div>
	</div>
</li>

<li class="pingback even thread-odd thread-alt depth-1" id="li-comment-985">
	<div id="comment-985">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://zfuniversity.com/2012/01/31/jason-grimes-using-doctrine-2-in-zend-framework-2/" rel="external nofollow" class="url">Jason Grimes: Using Doctrine 2 in Zend Framework 2 | Zend Framework University</a> - pingback on February 27, 2012 at 3:27 am</cite>
		</div>
	</div>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-1366">
	<div id="comment-1366">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/42a7750a7d0084d0b872ec37c802d73c.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Vinicius Garcia</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-1366">March 9, 2012 at 2:29 pm</a></span>
		</div>
		<div class="comment-text">
			<p>ok, but I supposed to put</p>
<p>public function setEntityManager(EntityManager $em)<br>
{<br>
    $this-&gt;_em = $em;<br>
}</p>
<p>In all my controllers?</p>
<p>I must set ‘orm_driver_chain’ =&gt; array(…) in all my modules?</p>
<p>In your example, you use the entity manager inside your controller.<br>
but, how can I use it in a service layer?</p>
<p>I don’t wanna pass the EM all the times like this:</p>
<p>$album = new \Album\Model\Album($this-&gt;_em);<br>
$album-&gt;save($data);</p>
<p>please, can you make a more advanced tutorial for doctrine2 and ZF2?</p>
<p>Thank you for your amazing post!<br>
I was trying to learn ZF1.11 but I gave up and decide to study ZF2!<br>
I hope you can help me!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=1366#respond" onclick='return addComment.moveForm("comment-1366", "1366", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-1531">
	<div id="comment-1531">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/752fafe7811cbfeb4fef0214d4b44d75.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">advicecat</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-1531">March 13, 2012 at 5:09 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hello. I’ve trying to follow your tutorial, but after all changes is done I’ve get error message</p>
<p><code><br>
Warning: class_parents(): Class Album\Entity\Album does not exist and 
could not be loaded in 
/www/dev/zf2/vendor/DoctrineORMModule/vendor/doctrine-orm/lib/vendor/doctrine-common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php
 on line 40<br>
</code></p>
<p>Can you help me, what I am doing wrone?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=1531#respond" onclick='return addComment.moveForm("comment-1531", "1531", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-2" id="li-comment-9959">
	<div id="comment-9959">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/467dcbf9866918177da607cd8f7881f1.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Thomas</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-9959">November 21, 2012 at 10:13 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I had the same problem, it’s because you need to put “namespace Album” at the top of module.config.php inside your module <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley"> .</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=9959#respond" onclick='return addComment.moveForm("comment-9959", "9959", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>

<li class="comment even thread-even depth-1" id="li-comment-1674">
	<div id="comment-1674">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/51a00d3c727979fe05904498bdd356ec.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Frank</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-1674">March 17, 2012 at 10:13 am</a></span>
		</div>
		<div class="comment-text">
			<p>I am learning ZF2 Doctrine 2 and have completed your tutorial and 
everything works fine.  Thank you.  Can you do a article on 
incorporating pagination please or maybe give me some hints how to 
procede.  I find most of the documentation hard to follow. I am 67 and I
 think learning curves are getting steeper for me.  Thanks, Frank</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=1674#respond" onclick='return addComment.moveForm("comment-1674", "1674", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-1836">
	<div id="comment-1836">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/64b522af30edf535465dce02110f21f6.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://techiesindiainc.com/" rel="external nofollow" class="url">Zend Framework</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-1836">March 22, 2012 at 12:22 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Very Much Impressive Tutorial, Follow the link for More valid information while using Zend Framework with Doctrine 2.<br>
<a href="http://blog.mayflower.de/index.php?url=archives/799-06.12.-Doctrine-2-Zend-Framework-Integration.html" rel="nofollow">http://blog.mayflower.de/index.php?url=archives/799-06.12.-Doctrine-2-Zend-Framework-Integration.html</a></p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=1836#respond" onclick='return addComment.moveForm("comment-1836", "1836", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-2134">
	<div id="comment-2134">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/60f0b959e94e4624ac7f35e50b795ec3.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Michael Helwig</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2134">April 8, 2012 at 8:42 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hi,<br>
nice tutorial! One little tweak is needed when using this with ZF2 
beta3: The file “module.doctrine_orm.config.php” should be named 
“module.doctrine_orm.global.config.php” – otherwise, it won’t be loaded 
(- see config/autoload/README.md) and you will get a “No Metadata 
Classes to process” message from the command line tool.<br>
Best, Michael</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2134#respond" onclick='return addComment.moveForm("comment-2134", "2134", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-2138">
	<div id="comment-2138">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/60f0b959e94e4624ac7f35e50b795ec3.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Michael Helwig</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2138">April 8, 2012 at 5:58 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hm, there seems to be more what is needed for using this 
configuration with ZF2 beta3. It didn’t work for me to set the 
EntityManager via DI (“Missing property exception”). However, I could 
get an Entity Manager when disablinge the DI-related Configuration in 
$PROJECT_DIR/module/Album/config/module.config.php (at least the 
orm_drivers_chain array) and use<br>
$em = $this-&gt;getLocator()-&gt;get(‘doctrine_em’);<br>
in the indexController.<br>
Would be nice to know how to make DI work, though. Has anyone had success with this tutorial and ZF2?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2138#respond" onclick='return addComment.moveForm("comment-2138", "2138", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-2140">
	<div id="comment-2140">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/60f0b959e94e4624ac7f35e50b795ec3.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Michael Helwig</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2140">April 8, 2012 at 6:47 pm</a></span>
		</div>
		<div class="comment-text">
			<p>It finally worked by simply disabling the orm_driver_chain config 
and leaving the rest of the configuration intact. My mistake: I also had
 disabled the DI-configuration in the same file.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2140#respond" onclick='return addComment.moveForm("comment-2140", "2140", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-2157">
	<div id="comment-2157">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/43320f3dfb8f9e794e3d53895fb2c085.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">ttt</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2157">April 10, 2012 at 4:06 am</a></span>
		</div>
		<div class="comment-text">
			<p>i am using ZF2 beta3 with DoctrineORMModule,but got the following error. </p>
<p>Compile Error: \ZendFramework\library\Zend\Loader\ClassMapAutoloader.php line 153 – require_once() [<a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/function.require" rel="nofollow">function.require</a>]:
 Failed opening required 
‘\vendor\DoctrineORMModule/vendor/doctrine-orm/lib/vendor/doctrine-dbal/lib/vendor/doctrine-common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php’
 (include_path=’.;C:\Program Files 
(x86)\Zend\ZendServer\share\ZendFramework\library’)</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2157#respond" onclick='return addComment.moveForm("comment-2157", "2157", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-2159">
	<div id="comment-2159">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/43320f3dfb8f9e794e3d53895fb2c085.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">ttt</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2159">April 10, 2012 at 5:09 am</a></span>
		</div>
		<div class="comment-text">
			<p>I follow the tutorial and use command ”<br>
git clone git://github.com/doctrine/DoctrineORMModule.git vendor/DoctrineORMModule –recursive ” to install DoctrineORMModule.<br>
but i check the folder 
vendor\DoctrineORMModule/vendor/doctrine-orm/lib/vendor/doctrine-dbal/lib/vendor/doctrine-common,it
 is empty.</p>
<p>do i miss any configuration?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2159#respond" onclick='return addComment.moveForm("comment-2159", "2159", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-2235">
	<div id="comment-2235">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/ebf38aabf68e0763b7a1cb5f20e894e6.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Ozzi</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2235">April 15, 2012 at 12:00 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I’ve been having trouble with setting up this tutorial with ZF2 beta 4. I got the following error:<br>
<code><br>
Fatal error: Uncaught exception 
'Zend\Di\Exception\MissingPropertyException' with message 'Missing 
instance/object for parameter params for 
DoctrineORMModule\Doctrine\ORM\Connection::__construct' in {..} 
vendor/ZendFramework/library/Zend/Di/Di.php:613<br>
Stack trace: ...<br>
</code></p>
<p>Maybe I dit something wrong (I’m new to ZF (2) and Doctrine <img src="Using_Doctrine_2_files/icon_razz.gif" alt=":P" class="wp-smiley"> ), but it seemed the parameters for the connection were not passed trough to the connection of Doctrine.<br>
After I’ve changed the<br>
<code><br>
            'orm_connection' =&gt; array(<br>
</code><br>
to<br>
<code><br>
            'DoctrineORMModule\Doctrine\ORM\Connection' =&gt; array(<br>
</code><br>
in the {..}vendor/DoctrineModule/config/module.config.php<br>
and in the  {..}config/autoload/module.doctrine_orm.local.config.php it seemed to work.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2235#respond" onclick='return addComment.moveForm("comment-2235", "2235", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-2265">
	<div id="comment-2265">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/10773ae6687b55736e171c038b4228d2.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.chazzuka.com/" rel="external nofollow" class="url">Komang</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2265">April 17, 2012 at 10:30 am</a></span>
		</div>
		<div class="comment-text">
			<p>@Ozzi that because in the definition it requires  <code>DoctrineORMModule\Doctrine\ORM\Connection</code> but in DI instance it uses alias. So change the definition into its alias will solve the problem</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2265#respond" onclick='return addComment.moveForm("comment-2265", "2265", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-2300">
	<div id="comment-2300">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/bb037021a18414c0e27e455b8fadc5f9.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Alejandro</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2300">April 19, 2012 at 6:16 pm</a></span>
		</div>
		<div class="comment-text">
			<p>i got the next error “Fatal error: Uncaught exception 
‘RuntimeException’ with message ‘Failed to load annotation mappings – 
check the “annotation_file” setting’ in 
C:\xampp\htdocs\zend2\vendor\DoctrineORMModule\Module.php:58 Stack 
trace: #0 [internal function]: 
DoctrineORMModule\Module-&gt;modulesLoaded(Object(Zend\Module\ModuleEvent))
 #1 
C:\xampp\htdocs\zend2\vendor\ZendFramework\library\Zend\EventManager\EventManager.php(457):
 call_user_func(Array, Object(Zend\Module\ModuleEvent)) #2 
C:\xampp\htdocs\zend2\vendor\ZendFramework\library\Zend\EventManager\EventManager.php(199):
 Zend\EventManager\EventManager-&gt;triggerListeners(‘loadModules.pos…’,
 Object(Zend\Module\ModuleEvent), NULL) #3 
C:\xampp\htdocs\zend2\vendor\ZendFramework\library\Zend\Module\Manager.php(74):
 Zend\EventManager\EventManager-&gt;trigger(‘loadModules.pos…’, 
Object(Zend\Module\Manager), Object(Zend\Module\ModuleEvent)) #4 
C:\xampp\htdocs\zend2\public\index.php(14): 
Zend\Module\Manager-&gt;loadModules() #5 {main} thrown in 
C:\xampp\htdocs\zend2\vendor\DoctrineORMModule\Module.php on line 58″</p>
<p>What i could do wrong?? please help me</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2300#respond" onclick='return addComment.moveForm("comment-2300", "2300", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-2302">
	<div id="comment-2302">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/bb037021a18414c0e27e455b8fadc5f9.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Alejandro</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2302">April 19, 2012 at 6:43 pm</a></span>
		</div>
		<div class="comment-text">
			<p>sorry i dont have the complete doctrine , but now i have this………………<br>
Fatal error: Uncaught exception 
‘Zend\Di\Exception\ClassNotFoundException’ with message ‘Class 
(specified by alias view) Zend\View\PhpRenderer could not be located in 
provided definitions.’ in 
C:\xampp\htdocs\zend2\vendor\ZendFramework\library\Zend\Di\Di.php:164 
Stack trace: #0 
C:\xampp\htdocs\zend2\vendor\ZendFramework\library\Zend\Di\Di.php(130): 
Zend\Di\Di-&gt;newInstance(‘view’, Array) #1 
C:\xampp\htdocs\zend2\module\Application\Module.php(71): 
Zend\Di\Di-&gt;get(‘view’) #2 
C:\xampp\htdocs\zend2\module\Application\Module.php(44): 
Application\Module-&gt;getView(Object(Zend\Mvc\Application)) #3 
[internal function]: 
Application\Module-&gt;initializeView(Object(Zend\EventManager\Event)) 
#4 
C:\xampp\htdocs\zend2\vendor\ZendFramework\library\Zend\EventManager\EventManager.php(457):
 call_user_func(Array, Object(Zend\EventManager\Event)) #5 
C:\xampp\htdocs\zend2\vendor\ZendFramework\library\Zend\EventManager\EventManager.php(199):
 Zend\EventManager\EventManager-&gt;triggerListeners(‘bootstrap’, 
Object(Zend\EventManager\Event), NULL) #6 C:\x in 
C:\xampp\htdocs\zend2\vendor\ZendFramework\library\Zend\Di\Di.php on 
line 164</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2302#respond" onclick='return addComment.moveForm("comment-2302", "2302", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-2" id="li-comment-2316">
	<div id="comment-2316">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/bb037021a18414c0e27e455b8fadc5f9.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Alejandro</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2316">April 20, 2012 at 4:09 pm</a></span>
		</div>
		<div class="comment-text">
			<p>what happend with Di ??</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2316#respond" onclick='return addComment.moveForm("comment-2316", "2316", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-2349">
	<div id="comment-2349">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/bb037021a18414c0e27e455b8fadc5f9.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Alejandro</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2349">April 23, 2012 at 2:30 pm</a></span>
		</div>
		<div class="comment-text">
			<p>someone has the complete proyect working??</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2349#respond" onclick='return addComment.moveForm("comment-2349", "2349", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-2476">
	<div id="comment-2476">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/9c8187f1d5975d99ce0f32be2786c87f.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">krishna m</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2476">May 1, 2012 at 5:41 am</a></span>
		</div>
		<div class="comment-text">
			<p>can I upload the modified version of doctrine</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2476#respond" onclick='return addComment.moveForm("comment-2476", "2476", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment byuser comment-author-jg bypostauthor even thread-odd thread-alt depth-1" id="li-comment-2502">
	<div id="comment-2502">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2502">May 3, 2012 at 2:33 am</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks, everyone, for pointing out things that were no longer working with recent versions of ZF2.</p>
<p>I’ve updated the article for ZF2 beta 3, the latest as of this writing.</p>
<p>The main changes are:</p>
<p>* Using the new ViewModel.</p>
<p>* Changing the Doctrine config file name in the autoload directory to
 module.doctrine_orm.local.config.php. (It looks like this name might 
change again soon–a recent ZF2 planning meeting discussed dropping the 
“module” and “config” portions of these config file names.)</p>
<p>Please let me know if you find anything that still isn’t working right.</p>
<p>Thanks!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2502#respond" onclick='return addComment.moveForm("comment-2502", "2502", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-2503">
	<div id="comment-2503">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/f3489ed3a6c174d804fe43d6b9e99c13.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Rafael</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2503">May 3, 2012 at 8:00 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hey,<br>
Great tutorial, it helped me to setup zf2 and doctrine quickly! Thank 
you! I would like also to suggest you, if possible, write how to unit 
test it.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2503#respond" onclick='return addComment.moveForm("comment-2503", "2503", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="pingback even thread-odd thread-alt depth-1" id="li-comment-2603">
	<div id="comment-2603">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://blog.redphoenixsoftware.com/?p=15" rel="external nofollow" class="url">Configuring an AWS Linux Instance to run PHP and MongoDB and Apache</a> - pingback on May 11, 2012 at 1:44 pm</cite>
		</div>
	</div>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-2604">
	<div id="comment-2604">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/3cf7a8ab0bccee5b65d39b50a170a555.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://marco-pivetta.com/" rel="external nofollow" class="url">Marco Pivetta</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2604">May 11, 2012 at 1:53 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hello there!<br>
I just wanted to invite anyone having issue with this procedure (also 
asking the author of the article if he can update it) to post any issue 
at <a href="https://github.com/doctrine/DoctrineORMModule/issues" rel="nofollow">https://github.com/doctrine/DoctrineORMModule/issues</a> .<br>
I’ve been working a bit on the module and the changes could not reflect 
what described in this article, so please eventually help me by keeping 
the DoctrineModule and DoctrineORMModule docs updated.</p>
<p>Thank you!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2604#respond" onclick='return addComment.moveForm("comment-2604", "2604", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-2624">
	<div id="comment-2624">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/49ff60fdb0397fac3d311c161c774967.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://rodmcenw.com/" rel="external nofollow" class="url">Rod Mcnew</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2624">May 13, 2012 at 6:15 am</a></span>
		</div>
		<div class="comment-text">
			<p>@Alejandro<br>
The git commands in this tutorial no longer download all of Doctrine’s files. (–recursive seems not to work)</p>
<p>Instead of running the git commands, I did the composer install from here and everything worked: <a href="https://github.com/doctrine/DoctrineORMModule" rel="nofollow">https://github.com/doctrine/DoctrineORMModule</a></p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2624#respond" onclick='return addComment.moveForm("comment-2624", "2624", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-2" id="li-comment-2632">
	<div id="comment-2632">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/3cf7a8ab0bccee5b65d39b50a170a555.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://marco-pivetta.com/" rel="external nofollow" class="url">Marco Pivetta</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2632">May 13, 2012 at 10:18 pm</a></span>
		</div>
		<div class="comment-text">
			<p>That is because submodules are not available at all anymore! I’ve dropped them because a single <code>clone --recursive</code> would cause something like 350Mb of disk space to be gone <img src="Using_Doctrine_2_files/icon_razz.gif" alt=":P" class="wp-smiley"> </p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2632#respond" onclick='return addComment.moveForm("comment-2632", "2632", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment byuser comment-author-jg bypostauthor even depth-2" id="li-comment-2644">
	<div id="comment-2644">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-2644">May 14, 2012 at 1:42 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks for the comment, Rod. I added a quick note to the article 
to use Composer instead of Git submodules, until I get time to bring the
 article up to date.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=2644#respond" onclick='return addComment.moveForm("comment-2644", "2644", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-3012">
	<div id="comment-3012">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/54420547651c5cbe8dd8f750de2060d8.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Youri</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3012">May 30, 2012 at 10:29 pm</a></span>
		</div>
		<div class="comment-text">
			<p>It would be nice to update with : <a href="http://zend-framework-community.634137.n4.nabble.com/ServiceManager-MVC-integration-merged-with-master-BC-breaking-changes-td4643952.html" rel="nofollow">http://zend-framework-community.634137.n4.nabble.com/ServiceManager-MVC-integration-merged-with-master-BC-breaking-changes-td4643952.html</a></p>
<p>Great job <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley"> </p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3012#respond" onclick='return addComment.moveForm("comment-3012", "3012", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-2" id="li-comment-3044">
	<div id="comment-3044">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/4b8c136c685884443ad1ca5e83826108.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Bert</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3044">June 1, 2012 at 11:01 am</a></span>
		</div>
		<div class="comment-text">
			<p>Indeed this tutorial need some updates.<br>
Rob Allen updated his tutorial for the new beta 4 what has some major changes.<br>
This tutorial doesnt work if u apply it over the tutorial from Rob.</p>
<p>Besides that i appriciate the work and it is still a good tutorial. Keep up the good work!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3044#respond" onclick='return addComment.moveForm("comment-3044", "3044", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor odd alt depth-3" id="li-comment-3078">
	<div id="comment-3078">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3078">June 3, 2012 at 3:34 am</a></span>
		</div>
		<div class="comment-text">
			<p>I finally updated the tutorial with support for ZF2 beta 4 and the
 new composer-based module installation. Please let me know if you find 
anything that still doesn’t work right.</p>
<p>Thanks for the feedback!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3078#respond" onclick='return addComment.moveForm("comment-3078", "3078", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-4" id="li-comment-3105">
	<div id="comment-3105">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/4b8c136c685884443ad1ca5e83826108.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Bert</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3105">June 4, 2012 at 3:50 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks for the update its working now.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3105#respond" onclick='return addComment.moveForm("comment-3105", "3105", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-3128">
	<div id="comment-3128">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/fd227bc937aac0b36dd9fe90c1d0705f.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Wil</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3128">June 5, 2012 at 10:58 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Good tutorial, it run perfectly for me.<br>
So.. I have a question, how can I handle EntityManager in an intermediate class between Entities and Controllers. I explain…<br>
e.g. If I want to do own queries with dql or sql, where exactly I should
 place, I’m thinking to doing in a class wich is instanciated by 
Controller and use entitymanager.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3128#respond" onclick='return addComment.moveForm("comment-3128", "3128", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor even depth-2" id="li-comment-3144">
	<div id="comment-3144">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3144">June 6, 2012 at 2:03 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Wil,</p>
<p>Thanks for the feedback.</p>
<p>I’d put custom queries inside a custom repository class. See <a href="http://readthedocs.org/docs/doctrine-orm/en/latest/reference/working-with-objects.html?highlight=repositories#custom-repositories" rel="nofollow">working with objects: custom repositories</a> in the Doctrine docs for an example.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3144#respond" onclick='return addComment.moveForm("comment-3144", "3144", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-3" id="li-comment-3150">
	<div id="comment-3150">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/fd227bc937aac0b36dd9fe90c1d0705f.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Wil</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3150">June 6, 2012 at 4:07 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks, just I wanted, it works already- Only a question, in my 
dql : ‘SELECT u FROM MyDomain\Model\User u WHERE u.status = “admin”‘ is 
not possible use User only.<br>
I’m trying but I have error wich doesn’t recognize Class User.<br>
Thanks again…!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3150#respond" onclick='return addComment.moveForm("comment-3150", "3150", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor even depth-4" id="li-comment-3183">
	<div id="comment-3183">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3183">June 9, 2012 at 2:29 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Wil,</p>
<p>Unfortunately, I don’t think it’s possible to use “SELECT u FROM 
User” instead of “SELECT u FROM MyDomain\Model\User”.  At least, not 
according to the <a href="http://readthedocs.org/docs/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#dql-select-clause" rel="nofollow">DQL SELECT clause documentation</a>, which says “The FROM keyword is always followed by a fully-qualified class name”.</p>
<p>Since the DQL query is just a string, I don’t see how Doctrine could automatically resolve the namespace from the calling code.</p>
<p>Jaosn</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3183#respond" onclick='return addComment.moveForm("comment-3183", "3183", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-5" id="li-comment-3376">
	<div id="comment-3376">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/fd227bc937aac0b36dd9fe90c1d0705f.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Wil</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3376">June 15, 2012 at 9:55 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I see, well actually it’s no problem work with this way. Thank you for information</p>
					</div>
		<div class="reply">
					</div>
	</div>

</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>

<li class="comment even thread-even depth-1" id="li-comment-3173">
	<div id="comment-3173">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/10c1786a9560905684a07a8fd13d20b2.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Alex</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3173">June 8, 2012 at 2:42 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hello, thanks for the tutorial.<br>
I followed the steps and I get this error</p>
<p>RuntimeException’ with message ‘Module (DoctrineModule) could not be initialized.’ </p>
<p>Could you help?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3173#respond" onclick='return addComment.moveForm("comment-3173", "3173", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-2" id="li-comment-3180">
	<div id="comment-3180">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/6ed086e4436e2429f57b567bce19301d.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Kieran</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3180">June 8, 2012 at 11:55 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Having the same issue here. I was so excited to see this project, then, you know – sad face.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3180#respond" onclick='return addComment.moveForm("comment-3180", "3180", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor even depth-3" id="li-comment-3182">
	<div id="comment-3182">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3182">June 9, 2012 at 2:09 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Kieran and Alex,</p>
<p>One possible cause of that error is that the doctrine vendor library 
doesn’t exist. Do you have a vendor/doctrine/DoctrineModule directory?</p>
<p>Try making sure you have <code>"doctrine/DoctrineORMModule": "dev-master"</code> in the <code>require</code> block of your composer.json, and then run <code>php composer.phar update</code> to download any missing vendor libraries.</p>
<p>If it helps, here’s my working version of the tutorial on Github: <a href="https://github.com/jasongrimes/zf2tutorial" rel="nofollow">https://github.com/jasongrimes/zf2tutorial</a></p>
<p>Please let me know how it goes.</p>
<p>Thanks,</p>
<p>Jason</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3182#respond" onclick='return addComment.moveForm("comment-3182", "3182", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-4" id="li-comment-3196">
	<div id="comment-3196">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/10c1786a9560905684a07a8fd13d20b2.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Alex</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3196">June 9, 2012 at 8:17 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Jason,</p>
<p>I have downloaded those files , seems not to recognize the path ‘vendor’</p>
<p>require_once (getenv(‘ZF2_PATH’) ?: ‘/vendor/doctrine’);</p>
<p>failed to open stream: Permission denied</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3196#respond" onclick='return addComment.moveForm("comment-3196", "3196", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-5" id="li-comment-3197">
	<div id="comment-3197">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/10c1786a9560905684a07a8fd13d20b2.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Alex</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3197">June 9, 2012 at 8:26 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Please ignore previous, is no the path vendor</p>
<p>require_once (getenv(‘ZF2_PATH’) ?: ‘/vendor/autoload.php’);</p>
<p>returns a 404</p>
					</div>
		<div class="reply">
					</div>
	</div>

</li>
</ul>
</li>

<li class="comment odd alt depth-4" id="li-comment-3200">
	<div id="comment-3200">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/6ed086e4436e2429f57b567bce19301d.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Kieran</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3200">June 9, 2012 at 11:14 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Ah – I didn’t have the vendor autoloader set up in my index.php. Thanks for that.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3200#respond" onclick='return addComment.moveForm("comment-3200", "3200", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even depth-4" id="li-comment-4912">
	<div id="comment-4912">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/f4151d1f645f715175c6f029b3b317a5.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Martin de Groot</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4912">July 23, 2012 at 7:08 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hello Jason, Alex and Kieran,<br>
I had a similar problem when running php composer.phar update, the error
 message was “The requested package doctrine/doctrineormmodule 
dev-master could not be found”<br>
I followed the reference to a discussion about composer-dev and managed 
to get a nice download en installation of doctrine with the following 
lines in the composer.json file:<br>
{<br>
 …<br>
 “homepage”: “http://framework.zend.com”,<br>
“minimum-stability”: “dev”,<br>
“require”: {<br>
  “php”: “&gt;=5.3.3″,<br>
  “zendframework/zendframework”:      “dev-master#dtb .. etc,<br>
<b>“doctrine/doctrine-orm-module”: “dev-master”</b><br>
  }<br>
}</p>
<p>The line about “minimum-stability” appears to me to be the important change from what is in Jason’s tutorial.<br>
I wrote this while composer was installing, so I hope that I can 
continue now with following your tutorial. Hope this helps for some 
others.</p>
<p>Martin de Groot</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4912#respond" onclick='return addComment.moveForm("comment-4912", "4912", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-3198">
	<div id="comment-3198">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/10c1786a9560905684a07a8fd13d20b2.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Alex</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3198">June 9, 2012 at 9:00 pm</a></span>
		</div>
		<div class="comment-text">
			<p>It´s working on vhost.<br>
Apoligize,<br>
Regards</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3198#respond" onclick='return addComment.moveForm("comment-3198", "3198", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-3427">
	<div id="comment-3427">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/a5408ecd6ed3688802ef096bbd002a80.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.spiffyjr.me/" rel="external nofollow" class="url">Kyle Spraggs</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3427">June 17, 2012 at 5:54 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Just wanted to let you know that this blog post needs updated as 
I’ve updated the DoctrineModule and DoctrineORMModule to ZF2 beta4. Few 
minor tweaks (connection/driver) and you should be good to go. Nice 
post.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3427#respond" onclick='return addComment.moveForm("comment-3427", "3427", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor odd alt depth-2" id="li-comment-3479">
	<div id="comment-3479">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3479">June 19, 2012 at 3:37 am</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks, Kyle! I updated the tutorial with the latest Doctrine installation instructions.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3479#respond" onclick='return addComment.moveForm("comment-3479", "3479", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-3431">
	<div id="comment-3431">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/bf61161c99f8735ac67e540adf1885e5.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Caio Costa</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3431">June 17, 2012 at 10:13 pm</a></span>
		</div>
		<div class="comment-text">
			<p>There’s a problem when a field don’t pass the validation, the 
select fields don’t set the submitted value (they don’t set nothing at 
all).<br>
I found that this occurs because the types don’t match. In this case, 
the value from the form is a string (because everything coming from a 
form is a string) and the options are integer, so in the in_array with 
strict on is never true.<br>
I don’t know how to solve this… could anyone help me please?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3431#respond" onclick='return addComment.moveForm("comment-3431", "3431", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor odd alt depth-2" id="li-comment-3485">
	<div id="comment-3485">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3485">June 19, 2012 at 10:32 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Caio,</p>
<p>I’m not totally sure I follow you, but does it work if you specify your option values as strings when defining your form?</p>
<p>Jason</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3485#respond" onclick='return addComment.moveForm("comment-3485", "3485", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>

<li class="comment even thread-even depth-1" id="li-comment-3534">
	<div id="comment-3534">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d87e98cdd93d1cfea33caabbbbce4672.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.lfcfans.at/" rel="external nofollow" class="url">Alex</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3534">June 20, 2012 at 4:13 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I followed your blog post but i’m not able to get the entity manager, i get a whole bunch of exceptions as you can se here <a href="http://pastebin.com/62VHregv" rel="nofollow">http://pastebin.com/62VHregv</a></p>
<p>Any Idea what goes wrong?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3534#respond" onclick='return addComment.moveForm("comment-3534", "3534", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-2" id="li-comment-3538">
	<div id="comment-3538">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d87e98cdd93d1cfea33caabbbbce4672.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.lfcfans.at/" rel="external nofollow" class="url">Alex</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3538">June 20, 2012 at 5:28 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Ok i think i found it, it seems i used a wrong zf2 commit.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3538#respond" onclick='return addComment.moveForm("comment-3538", "3538", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment byuser comment-author-jg bypostauthor even depth-3" id="li-comment-3539">
	<div id="comment-3539">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b690896e21a3ffd7503696b80d0aa807.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.jasongrimes.org/" rel="external nofollow" class="url">Jason</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-3539">June 20, 2012 at 5:37 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Alex,</p>
<p>Glad you sorted it out. I noticed that the <a href="https://github.com/doctrine/DoctrineORMModule#readme" rel="nofollow">DoctrineORMModule README file</a> says the service is registered as <code>doctrine.entitymanager.orm_default</code> instead of <code>Doctrine\ORM\EntityManager</code>, so I made that change in the tutorial code as well. Both ways seem to work for me right now, though.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=3539#respond" onclick='return addComment.moveForm("comment-3539", "3539", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt depth-3" id="li-comment-10786">
	<div id="comment-10786">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/e31580898a333fb699c26f3ae305af30.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Ahsan</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-10786">December 6, 2012 at 5:35 am</a></span>
		</div>
		<div class="comment-text">
			<p>Alex can you please tell me how do you solve this issue? I’m stuck on it.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=10786#respond" onclick='return addComment.moveForm("comment-10786", "10786", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>
</ul>
</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-4421">
	<div id="comment-4421">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/564dfa0080818a70e481f803fb41af16.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Sam</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4421">July 11, 2012 at 5:24 pm</a></span>
		</div>
		<div class="comment-text">
			<p>“doctrine/DoctrineORMModule”: “dev-master” within the require 
block and an “php composer.phar update” results in “Your requirements 
could not be solved to an installable set of 
packages.”[...]“doctrine/doctrinemodule dev-master -&gt; no matching 
package found”</p>
<p>I get this in both working environments (home and work) – any ideas?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4421#respond" onclick='return addComment.moveForm("comment-4421", "4421", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-2" id="li-comment-4443">
	<div id="comment-4443">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/564dfa0080818a70e481f803fb41af16.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Sam</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4443">July 12, 2012 at 5:31 am</a></span>
		</div>
		<div class="comment-text">
			<p>Using “doctrine/doctrine-orm-module”: “dev-master” as hinted at 
the README file from Doctrines github results in not found packages, too
 :S</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4443#respond" onclick='return addComment.moveForm("comment-4443", "4443", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even depth-2" id="li-comment-4446">
	<div id="comment-4446">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/564dfa0080818a70e481f803fb41af16.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Sam</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4446">July 12, 2012 at 5:58 am</a></span>
		</div>
		<div class="comment-text">
			<p>OK, the reason it didn’t work is because the files are not STABLE.
 You need to add “minimum-stability”: “dev”, to the root of your 
composer.json and then it works. Be sure to remove this line though, 
ones the modules go stable</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4446#respond" onclick='return addComment.moveForm("comment-4446", "4446", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-3" id="li-comment-10446">
	<div id="comment-10446">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/4c615ec53ca0f72c0215571987daff4d.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Johan</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-10446">November 30, 2012 at 10:19 pm</a></span>
		</div>
		<div class="comment-text">
			<p>thanks!!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=10446#respond" onclick='return addComment.moveForm("comment-10446", "10446", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>
</ul>
</li>

<li class="comment even thread-even depth-1" id="li-comment-4513">
	<div id="comment-4513">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/2b32af7756fbcd2be42cb61541ac4f27.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.copptech.com/" rel="external nofollow" class="url">illegal download</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4513">July 13, 2012 at 6:20 pm</a></span>
		</div>
		<div class="comment-text">
			<p>While our competitors use useless techniques in stopping digital piracy,<br>
we use our insights about the guerrilla file-sharing scene.<br>
Whereas you can find a good number of the data via simple and<br>
easy search parameters, those files are already downloaded thousands maybe even more times.</p>
<p>We guarantee that we eliminate the Source movies that come from non-indexed blogs or membership<br>
web sites. That will restrict any serious distribution to file-sharing or streaming websites that are popular to<br>
the majority of the internet.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4513#respond" onclick='return addComment.moveForm("comment-4513", "4513", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-4534">
	<div id="comment-4534">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/0a3e5365feea4d44d927d9120c95c0d3.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Greg</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4534">July 14, 2012 at 5:13 am</a></span>
		</div>
		<div class="comment-text">
			<p>Anyone have any luck with zf2 Beta 5.  The album list displays find, but edit and delete doesn’t work.</p>
<p>Just curious if anyone else has had any luck.</p>
<p>Thanks,</p>
<p>Greg</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4534#respond" onclick='return addComment.moveForm("comment-4534", "4534", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-4562">
	<div id="comment-4562">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b73fb424c5739eb0c01c6779ed5a9f6d.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Blaimi</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4562">July 14, 2012 at 9:32 pm</a></span>
		</div>
		<div class="comment-text">
			<p>there are a few differences for beta5:</p>
<p>• the composer.json config differs (look at doctrine-readme) [1]<br>
• <i>populate()</i> is now <i>exchangeArray()</i><br>
• <i>Zend\Mvc\Controller\ActionController</i> is now <i>Zend\Mvc\Controller\AbstractActionController</i><br>
• <i>$this-&gt;getEvent()-&gt;getRouteMatch()-&gt;getParam(‘id’)</i> is now <i>$this-&gt;params(‘id’)</i><br>
• I don’t have <i>$form-&gt;setBindOnValidate(false)</i> or <i>$form-&gt;bindValues()</i><br>
• at the <i>deleteAction</i> I had to remove <i>-&gt;getArrayCopy</i> to work.<br>
• There are two different Versions of <i>getEntityManager()</i> in the article above. The Version with <i>Doctrine\ORM\EntityManager</i> works for me, so I didn’t add the above one.</p>
<p>To get it work, I also had to do the changes described in doctrine issue #79 [2]</p>
<p>I’m not really sure that that was everything. Can anyone please confirm, so Jason can adjust the article.</p>
<p>1: <a href="https://github.com/doctrine/DoctrineORMModule/blob/master/README.md" rel="nofollow">https://github.com/doctrine/DoctrineORMModule/blob/master/README.md</a><br>
2: <a href="https://github.com/doctrine/DoctrineORMModule/issues/79" rel="nofollow">https://github.com/doctrine/DoctrineORMModule/issues/79</a></p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4562#respond" onclick='return addComment.moveForm("comment-4562", "4562", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-2" id="li-comment-4563">
	<div id="comment-4563">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b73fb424c5739eb0c01c6779ed5a9f6d.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Blaimi</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4563">July 14, 2012 at 9:57 pm</a></span>
		</div>
		<div class="comment-text">
			<p>doctrine Issue #79 is fixed and closed</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4563#respond" onclick='return addComment.moveForm("comment-4563", "4563", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-3" id="li-comment-11627">
	<div id="comment-11627">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/64ea4f1de5abb7c7313263eb6dec8f9e.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://urwebsite.blogspot.in/" rel="external nofollow" class="url">sunel</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-11627">December 13, 2012 at 8:46 am</a></span>
		</div>
		<div class="comment-text">
			<p>do u have the solution for this issue</p>
<p>Warning: class_parents(): Class User\Entity\User does not exist and 
could not be loaded in 
D:\xampp\htdocs\Sitezar\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\RuntimeReflectionService.php
 on line 40</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=11627#respond" onclick='return addComment.moveForm("comment-11627", "11627", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>
</ul>
</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-4571">
	<div id="comment-4571">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/0a3e5365feea4d44d927d9120c95c0d3.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Greg</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4571">July 15, 2012 at 1:17 am</a></span>
		</div>
		<div class="comment-text">
			<p>Items I’ve tweaked with success in ZF2 Beta 5 and latest doctrine release so far.  </p>
<p>1 – To allow index action to load – Changed AlbumController to extend AbstractActionController  i.e. change:</p>
<p>use Zend\Mvc\Controller\ActionController;<br>
//….<br>
//….<br>
class AlbumController extends ActionController</p>
<p>to </p>
<p>use Zend\Mvc\Controller\AbstractActionController;<br>
//….<br>
//….<br>
class AlbumController extends AbstractActionController</p>
<p>2 – To allow index action to load file was requesting 
ZendStorageCacheFactory from DoctrineModule/Service dir.  The Class 
couldn’t be found, looks like the class in the directory was 
ZendCacheStorageFactory so duplicated class and created a 
ZendStorageCacheFactory class, changed name of class to match as well  
(Note this wasn’t happening at first, showed up after I reloaded files 
using composer, might have accidentally pulled in a different build of 
composer)</p>
<p>3 – To allow the delete action to load – in AlbumController.php in 
public function deleteAction, at bottom in the return array( ) I 
commented out the -&gt;get array copy() from the line:</p>
<p>‘album’ =&gt; $this-&gt;getEntityManager()-&gt;find(‘Album\Entity\Album’, $id)  //-&gt;getArrayCopy()</p>
<p>4 – Fix delete action – change the post() function to getPost() in the deleteAction() function.  I.e. change from:</p>
<p>$del = $request-&gt;Post()-&gt;get(‘del’, ‘No’);<br>
            if ($del == ‘Yes’) {<br>
                $id = (int)$request-&gt;Post()-&gt;get(‘id’);</p>
<p>to</p>
<p>$del = $request-&gt;getPost()-&gt;get(‘del’, ‘No’);<br>
            if ($del == ‘Yes’) {<br>
                $id = (int)$request-&gt;getPost()-&gt;get(‘id’);</p>
<p>5 – Change delete action redirect to:</p>
<p>            // Redirect to list of albums<br>
            return $this-&gt;redirect()-&gt;toRoute(‘album’);</p>
<p>6 – To fix edit action change the the public function editAction() of the AlbumController change the post() to getPost():</p>
<p>            $form-&gt;setData($request-&gt;post());</p>
<p>to</p>
<p>            $form-&gt;setData($request-&gt;getPost());</p>
<p>6 – To fix the addAction() function in the AlbumController change the post() to getPost() i.e. change </p>
<p>$form-&gt;setData($request-&gt;post());</p>
<p>to </p>
<p>$form-&gt;setData($request-&gt;getPost());</p>
<p>Seems to have it up and working for me – thanks everyone who put in 
all the hard work on coding these items, and providing the tutorials.  
Been a real help for me so far.  Been fun for me to dive into something 
new, really like ZF2 and the doctrine module so far.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4571#respond" onclick='return addComment.moveForm("comment-4571", "4571", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-2" id="li-comment-10524">
	<div id="comment-10524">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/1d636bbb1af1dbda51d5c7abab2003b1.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Morgan</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-10524">December 2, 2012 at 4:37 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley"> </p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=10524#respond" onclick='return addComment.moveForm("comment-10524", "10524", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-3" id="li-comment-22485">
	<div id="comment-22485">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/71dfcfb799821b0098d9db0d7f72f8cd.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Nikitas</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-22485">March 7, 2013 at 9:58 am</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks so much for that update! works perfect!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=22485#respond" onclick='return addComment.moveForm("comment-22485", "22485", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>
</ul>
</li>

<li class="comment even thread-even depth-1" id="li-comment-4572">
	<div id="comment-4572">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/0a3e5365feea4d44d927d9120c95c0d3.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Greg</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4572">July 15, 2012 at 1:23 am</a></span>
		</div>
		<div class="comment-text">
			<p>Ah, as Blaimi posted looks like they already fixed the 
ZendStorageCache error for doctrine.  So you can probably ignore that 
part of my fix above.</p>
<p>Notes from Git<br>
got an error after install. “Class ZendStorageCacheFactory” not found …</p>
<p>Issue resolved</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4572#respond" onclick='return addComment.moveForm("comment-4572", "4572", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-4765">
	<div id="comment-4765">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/877b557c5d8ad221b6dae930c9d6ce35.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.gamempire.it/" rel="external nofollow" class="url">Oscar</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4765">July 19, 2012 at 4:10 pm</a></span>
		</div>
		<div class="comment-text">
			<p>ATTENTION (to user with ZF beta5)</p>
<p>With the ZF2 beta5, in the AlbumController, you have to use the AbstractActionController instead of the ActionController</p>
<p>And request-&gt;getPost() instead of request-&gt;post()</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4765#respond" onclick='return addComment.moveForm("comment-4765", "4765", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-4816">
	<div id="comment-4816">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d2f8cd3f9a484efd2901b120aa3ee411.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Allreddy</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4816">July 20, 2012 at 11:28 pm</a></span>
		</div>
		<div class="comment-text">
			<p>while installing doctrine with composer shouldn’t it be 
“doctrine/Doctrine-ORM-Module”: “dev-master” instead of 
“doctrine/DoctrineORMModule”: “dev-master”?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4816#respond" onclick='return addComment.moveForm("comment-4816", "4816", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-4947">
	<div id="comment-4947">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/a04db15e59184d2653f6febba3d14310.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Dah</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4947">July 24, 2012 at 2:37 pm</a></span>
		</div>
		<div class="comment-text">
			<p>hi everyone,<br>
nice tutorial, but I’m confronted with this error </p>
<p>Class Album\Entity\Album is not a valid entity or mapped super class.</p>
<p>I use Zf2 Beta5,</p>
<p>Somebody can help me?</p>
<p>Thanks</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4947#respond" onclick='return addComment.moveForm("comment-4947", "4947", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-4948">
	<div id="comment-4948">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/a04db15e59184d2653f6febba3d14310.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Dah</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-4948">July 24, 2012 at 2:52 pm</a></span>
		</div>
		<div class="comment-text">
			<p>hi everyone,<br>
nice tutorial, but I’m confronted with this error</p>
<p>Class Album\Entity\Album is not a valid entity or mapped super class.</p>
<p>I use Zf2 Beta5,</p>
<p>Somebody can help me?</p>
<p>Thanks</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=4948#respond" onclick='return addComment.moveForm("comment-4948", "4948", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-5160">
	<div id="comment-5160">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/13e25a91e48a2ebbe170bc93e7a818b3.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">mludewig</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5160">July 30, 2012 at 3:20 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hey @all,<br>
i’ve the same problem with the latest version installed by composer. 
after copy the (before) working album module to /modules/ , i get the<br>
“Class Album\Entity\Album is not a valid entity or mapped super class” 
message. is there anything we must change in the current album code to 
make the code running? Or is there a probleme in DoctrineORM latest code
 ??<br>
Thanks a lot</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5160#respond" onclick='return addComment.moveForm("comment-5160", "5160", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-5348">
	<div id="comment-5348">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d329b3dc6ace1181962816844b89bd01.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Klea</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5348">August 6, 2012 at 8:45 am</a></span>
		</div>
		<div class="comment-text">
			<p>module.php must be adjusted?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5348#respond" onclick='return addComment.moveForm("comment-5348", "5348", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-5352">
	<div id="comment-5352">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/ee8ddfd10cb3c27862ee3eb2e6bed084.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">webdefy</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5352">August 6, 2012 at 9:50 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hi all,<br>
as Dah and mludewig, I am also encountering the same problem with error message:<br>
<code>Class Album\Entity\Album does not exist</code></p>
<p>Any updates on this issue. I am also using ZF2 Beta 5.</p>
<p>Thanks</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5352#respond" onclick='return addComment.moveForm("comment-5352", "5352", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-5354">
	<div id="comment-5354">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d329b3dc6ace1181962816844b89bd01.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Klea</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5354">August 6, 2012 at 10:47 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hallo webdefy! </p>
<p>I had the problem too but I do not know how I fixed it. <img src="Using_Doctrine_2_files/icon_sad.gif" alt=":(" class="wp-smiley"><br>
I think orm was not installed. </p>
<p>my require in composer.json for zf2 2.0.0 rc1</p>
<p>“require”: {<br>
        “php”: “&gt;=5.3.3″,<br>
        “zendframework/zendframework”: “dev-master”<br>
        ,”zendframework/zend-developer-tools”: “dev-master”<br>
        ,”doctrine/doctrine-orm-module”: “dev-master”<br>
        ,”doctrine/migrations”: “dev-master”<br>
        ,”doctrine/dbal”: “2.2.2″<br>
        ,”doctrine/common”: “2.2.2″<br>
        ,”doctrine/doctrine-module”: “dev-master”<br>
        ,”doctrine/data-fixtures”: “dev-master”<br>
    }</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5354#respond" onclick='return addComment.moveForm("comment-5354", "5354", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-5356">
	<div id="comment-5356">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/ee8ddfd10cb3c27862ee3eb2e6bed084.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">webdefy</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5356">August 6, 2012 at 11:16 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hallo Klea,<br>
thanks for replying to my post, I followed you suggestion, but alas with no better results. Any other suggestion</p>
<p>Thanks</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5356#respond" onclick='return addComment.moveForm("comment-5356", "5356", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-5357">
	<div id="comment-5357">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d329b3dc6ace1181962816844b89bd01.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Klea</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5357">August 6, 2012 at 11:51 am</a></span>
		</div>
		<div class="comment-text">
			<p>i share my code with you on bitbucket. <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley">  </p>
<p><a href="https://bitbucket.org/anjheu/zf2_doctrine2/" rel="nofollow">https://bitbucket.org/anjheu/zf2_doctrine2/</a> </p>
<p>but it’s not perfect, i have now error message : </p>
<p>Class Album\Entity\Album is not a valid entity or mapped super class.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5357#respond" onclick='return addComment.moveForm("comment-5357", "5357", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-5358">
	<div id="comment-5358">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/ee8ddfd10cb3c27862ee3eb2e6bed084.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">webdefy</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5358">August 6, 2012 at 12:08 pm</a></span>
		</div>
		<div class="comment-text">
			<p>@Klea, I have now exactly the same error:<br>
<code>Class Album\Entity\Album is not a valid entity or mapped super class.</code>. Well has somebody an idea how to resolve this.</p>
<p>Thanks</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5358#respond" onclick='return addComment.moveForm("comment-5358", "5358", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-even depth-1" id="li-comment-5364">
	<div id="comment-5364">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d329b3dc6ace1181962816844b89bd01.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Klea</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5364">August 6, 2012 at 2:07 pm</a></span>
		</div>
		<div class="comment-text">
			<p>fixed <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley"> </p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5364#respond" onclick='return addComment.moveForm("comment-5364", "5364", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-2" id="li-comment-13140">
	<div id="comment-13140">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/64ea4f1de5abb7c7313263eb6dec8f9e.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://urwebsite.blogspot.in/" rel="external nofollow" class="url">sunel</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-13140">January 2, 2013 at 8:20 am</a></span>
		</div>
		<div class="comment-text">
			<p>how did u fix the error</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=13140#respond" onclick='return addComment.moveForm("comment-13140", "13140", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-5401">
	<div id="comment-5401">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/a04db15e59184d2653f6febba3d14310.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Dah</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5401">August 7, 2012 at 2:09 pm</a></span>
		</div>
		<div class="comment-text">
			<p>@Klea</p>
<p>Thanks, I’ll try it</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5401#respond" onclick='return addComment.moveForm("comment-5401", "5401", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-5403">
	<div id="comment-5403">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/a04db15e59184d2653f6febba3d14310.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Dah</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5403">August 7, 2012 at 2:57 pm</a></span>
		</div>
		<div class="comment-text">
			<p>@Klea,</p>
<p>Great! it’s work fine with DoctrineMongoODMModule too</p>
<p>thanks</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5403#respond" onclick='return addComment.moveForm("comment-5403", "5403", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-5439">
	<div id="comment-5439">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d329b3dc6ace1181962816844b89bd01.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Klea</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5439">August 8, 2012 at 12:08 pm</a></span>
		</div>
		<div class="comment-text">
			<p>thanks also to james <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley"> </p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5439#respond" onclick='return addComment.moveForm("comment-5439", "5439", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-5471">
	<div id="comment-5471">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d329b3dc6ace1181962816844b89bd01.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Klea</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5471">August 9, 2012 at 8:51 am</a></span>
		</div>
		<div class="comment-text">
			<p>jason, sorry :/</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5471#respond" onclick='return addComment.moveForm("comment-5471", "5471", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-5473">
	<div id="comment-5473">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/fbcf11fbd22d7252c1f42e2f7fa4d5d9.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">snorri</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5473">August 9, 2012 at 10:39 am</a></span>
		</div>
		<div class="comment-text">
			<p>Thank you for this tutorial. I have always thought one argument 
for using doctrine was that it reduces the code to be written for db 
interactions.<br>
Comparing the original Album Controller with yours reveals the opposite.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5473#respond" onclick='return addComment.moveForm("comment-5473", "5473", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-5477">
	<div id="comment-5477">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/fbcf11fbd22d7252c1f42e2f7fa4d5d9.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">snorri</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5477">August 9, 2012 at 11:30 am</a></span>
		</div>
		<div class="comment-text">
			<p>Rob Allen’s code on github does not comply with his pdf-tutorial. So which one is up-to-date?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5477#respond" onclick='return addComment.moveForm("comment-5477", "5477", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-5500">
	<div id="comment-5500">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/fbcf11fbd22d7252c1f42e2f7fa4d5d9.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">snorri</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5500">August 9, 2012 at 8:20 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I get this Error:<br>
PHP Fatal error:  Class 
‘Doctrine\\Common\\Annotations\\AnnotationRegistry’ not found in 
/usr/local/zend/apache2/htdocs/zf2-tutorial/vendor/DoctrineORMModule/src/DoctrineORMModule/Module.php
 on line 65</p>
<p>DoctrineModule and DoctrineORMModule are both installed to vendor directory.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5500#respond" onclick='return addComment.moveForm("comment-5500", "5500", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-5595">
	<div id="comment-5595">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d329b3dc6ace1181962816844b89bd01.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Klea</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5595">August 12, 2012 at 5:51 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi snorri! </p>
<p>Unfortunately I have no time to concern myself with this issue. <img src="Using_Doctrine_2_files/icon_sad.gif" alt=":(" class="wp-smiley">
  The /vendor/doctrine/common directory doesn’t exist. Right? To fix you
 have to edit your composer.json to load “doctrine/common” and run 
composer.phar update i think.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5595#respond" onclick='return addComment.moveForm("comment-5595", "5595", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-5696">
	<div id="comment-5696">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/9c8187f1d5975d99ce0f32be2786c87f.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">krishna m</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5696">August 15, 2012 at 1:09 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi</p>
<p>    I have an issue , i need help  in creating the forms. Assume the 
there are group of fields  and added to fieldset and multiple fieldsets 
are added using collections  but i am unable to validate the form </p>
<p>Thank u,<br>
with Regards,</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5696#respond" onclick='return addComment.moveForm("comment-5696", "5696", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-5698">
	<div id="comment-5698">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/7dbe87cedd24ed387e4073b05f2461d4.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">sano</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5698">August 15, 2012 at 1:49 pm</a></span>
		</div>
		<div class="comment-text">
			<p>i have en error when i want to use doctrine command do generate entities:</p>
<p>Fatal error: Class ‘Zend_Config_Ini’ not found in D:\diploma\oglasnik\db\cli-con<br>
fig.php on line 29</p>
<p>29 line is cli-config.php is:</p>
<p>$config = new Zend_Config_Ini( APPLICATION_PATH . ‘/../application/configs/application.ini’,'development’);</p>
<p>I realy need some help, because i am new with doctrine <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley"><br>
Tnx</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5698#respond" onclick='return addComment.moveForm("comment-5698", "5698", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="pingback even thread-odd thread-alt depth-1" id="li-comment-5715">
	<div id="comment-5715">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://blog.redphoenixsoftware.com/zf2-beta-4-with-mongodb-installation/" rel="external nofollow" class="url">ZF2 Beta 4, MongoDB, and Doctrine installation - RPS</a> - pingback on August 15, 2012 at 11:55 pm</cite>
		</div>
	</div>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-5872">
	<div id="comment-5872">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d87e98cdd93d1cfea33caabbbbce4672.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.lfcfans.at/" rel="external nofollow" class="url">Alex</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-5872">August 19, 2012 at 3:52 pm</a></span>
		</div>
		<div class="comment-text">
			<p>The composer require String changed from<br>
“doctrine/doctrineORMModule”: “dev-master”<br>
to<br>
“doctrine/doctrine-orm-module”: “dev-master”</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=5872#respond" onclick='return addComment.moveForm("comment-5872", "5872", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-6229">
	<div id="comment-6229">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/3f839c230f68154983118000a1d1a34c.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">John</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-6229">August 29, 2012 at 3:00 pm</a></span>
		</div>
		<div class="comment-text">
			<p>This is a great article however I am having difficulty on the last step, getting the entity loaded, I keep getting this error:</p>
<p>Class Album\Entity\Album is not a valid entity or mapped super class.</p>
<p>Any ideas how to fix this? Seems like alot of people are getting this same error</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=6229#respond" onclick='return addComment.moveForm("comment-6229", "6229", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-6246">
	<div id="comment-6246">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/0e0ee8a2845f387f9f1fd9b33c0ab8e0.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Bba</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-6246">August 30, 2012 at 1:37 am</a></span>
		</div>
		<div class="comment-text">
			<p>This is a great article.<br>
Looking forward to working with the mongodb odm</p>
<p>Thanks a lot.<br>
God Bless you.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=6246#respond" onclick='return addComment.moveForm("comment-6246", "6246", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-6619">
	<div id="comment-6619">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/487e1fd4b948bc05082eaf1ca165acf0.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Carlos Acedo</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-6619">September 10, 2012 at 7:53 am</a></span>
		</div>
		<div class="comment-text">
			<p>Thank you very much! After a few adjustments I got it ready and working.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=6619#respond" onclick='return addComment.moveForm("comment-6619", "6619", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-6627">
	<div id="comment-6627">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/00194a9bd76f7c5267168a03a2a3f53a.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Eugene</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-6627">September 10, 2012 at 3:26 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I’ve done everything with default skeleton application and the 
transfered changes from Akrabat’s and it worked, but after adding line 
to composer.json as described here I’m getting</p>
<p><code><br>
Loading composer repositories with package information<br>
Updating dependencies<br>
Segmentation fault<br>
</code></p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=6627#respond" onclick='return addComment.moveForm("comment-6627", "6627", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-6649">
	<div id="comment-6649">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/ee8ddfd10cb3c27862ee3eb2e6bed084.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">webdefy</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-6649">September 11, 2012 at 8:12 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hi all,<br>
had any one worked on the validation part using Doctrine 2 and Zend 
Framework 2, I am looking for an example for validate fields, for 
example in this Album module validate the Album name for duplicate 
records in the database. In case any one worked on this, can share some 
knowledge here. Thanks</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=6649#respond" onclick='return addComment.moveForm("comment-6649", "6649", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="pingback odd alt thread-even depth-1" id="li-comment-6737">
	<div id="comment-6737">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://jisku.com/blog/2012/09/use-of-doctrine-2-in-zend-framework-2/" rel="external nofollow" class="url">Use of Doctrine 2 in Zend Framework 2 | Jisku.com - Developers Network</a> - pingback on September 13, 2012 at 1:31 pm</cite>
		</div>
	</div>
</li>

<li class="pingback even thread-odd thread-alt depth-1" id="li-comment-6856">
	<div id="comment-6856">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://jisku.com/blog/2012/09/how-to-use-memcached-in-doctrine2-zf2/" rel="external nofollow" class="url">How to use Memcached in Doctrine2 / ZF2? | Jisku.com - Developers Network</a> - pingback on September 17, 2012 at 4:12 pm</cite>
		</div>
	</div>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-6892">
	<div id="comment-6892">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/412c718a9b8d8ba1a35554ab414e2624.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">cher</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-6892">September 19, 2012 at 8:50 am</a></span>
		</div>
		<div class="comment-text">
			<p>i got this error message, “SQLSTATE[28000] [1045] Access denied for user ‘username’@'localhost’ (using password: YES)”</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=6892#respond" onclick='return addComment.moveForm("comment-6892", "6892", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-6893">
	<div id="comment-6893">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/3f7853a23c7b1f200615f23bfc48eb71.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.sergiorinaudo.com/" rel="external nofollow" class="url">Sergio</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-6893">September 19, 2012 at 9:11 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hello everyone,<br>
thanks to the author for this tutorial.<br>
I have a question, it is possible to autogenerate the entity class?</p>
<p>I have db tables with more than hundred columns, it would be a long and repetitive work to create entity classes by hand.</p>
<p>Thanks</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=6893#respond" onclick='return addComment.moveForm("comment-6893", "6893", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-6908">
	<div id="comment-6908">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/412c718a9b8d8ba1a35554ab414e2624.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">cher</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-6908">September 20, 2012 at 1:35 am</a></span>
		</div>
		<div class="comment-text">
			<p>can anyone answer my question??please?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=6908#respond" onclick='return addComment.moveForm("comment-6908", "6908", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-6933">
	<div id="comment-6933">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/412c718a9b8d8ba1a35554ab414e2624.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">cher</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-6933">September 21, 2012 at 2:35 am</a></span>
		</div>
		<div class="comment-text">
			<p>the following lines should be pasted inside PROJECT_DIR\config\autoload\local.php [not in local.php.dist]:</p>
<p>return array(<br>
    // …<br>
    ‘doctrine’ =&gt; array(<br>
        ‘connection’ =&gt; array(<br>
            ‘orm_default’ =&gt; array(<br>
                ‘driverClass’ =&gt; ‘Doctrine\DBAL\Driver\PDOMySql\Driver’,<br>
                ‘params’ =&gt; array(<br>
                    ‘host’     =&gt; ‘localhost’,<br>
                    ‘port’     =&gt; ’3306′,<br>
                    ‘user’     =&gt; ”,<br>
                    ‘password’ =&gt; ”,<br>
                    ‘dbname’   =&gt; ‘zf2tutorial’,<br>
                )<br>
            )<br>
        )<br>
    ),<br>
);</p>
<p>. .it solved my problem, thanks for this wonderful tutorial <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley"> </p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=6933#respond" onclick='return addComment.moveForm("comment-6933", "6933", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-7119">
	<div id="comment-7119">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/3c7f41db0b4aeed61bbddd6658b7335d.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">SlaWitDev</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-7119">September 28, 2012 at 4:22 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks for nice and useful intro to Doctrine.</p>
<p>In my case I change in ActionControler deleteAction<br>
<b>from:</b><br>
<code><br>
return array(<br>
    'id' =&gt; $id,<br>
    'album' =&gt; $this-&gt;getEntityManager()-&gt;find('Album\Entity\Album', $id)-&gt;getArrayCopy()<br>
  );<br>
</code><br>
to:<br>
<code><br>
return array(<br>
    'id' =&gt; $id,<br>
    'album' =&gt; $this-&gt;getEntityManager()-&gt;find('Album\Entity\Album', $id)<br>
//remove -&gt;getArrayCopy() for object like access in phtml to album var<br>
  );<br>
</code><br>
without this example not work <b>Notice: Trying to get property of non-object in …/delete.phtml</b> [$album-&gt;title]</p>
<p>Thanks and sorry for my English is not my native</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=7119#respond" onclick='return addComment.moveForm("comment-7119", "7119", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-7160">
	<div id="comment-7160">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/49db5258d09b9d00acf876376a78a061.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">IS</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-7160">October 1, 2012 at 12:37 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hi, </p>
<p>First of all thanks for this great tutorial.</p>
<p>I got this error when I submitted data from the “add” action.</p>
<p>Call to undefined method Zend\Http\PhpEnvironment\Request::post() in 
C:\xampp\htdocs\zendskeleton\module\Album\src\Album\Controller\AlbumController.php
 on line …</p>
<p>Changing this line in the addAction<br>
<code><br>
$form-&gt;setData($request-&gt;post());<br>
</code></p>
<p>to this line</p>
<p><code><br>
$form-&gt;setData($request-&gt;getPost());<br>
</code></p>
<p>fixed it.</p>
<p>Is this the right way to do it ?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=7160#respond" onclick='return addComment.moveForm("comment-7160", "7160", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-7393">
	<div id="comment-7393">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/482517e3e7f1be3c858dbdb4b8f288a1.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">shirkavand</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-7393">October 9, 2012 at 10:26 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hey Jason,</p>
<p>i think composer doesn’t accept names with capital letters in any longer, so:</p>
<p>“require”: {<br>
        …,<br>
        “doctrine/DoctrineORMModule”: “dev-master”<br>
}</p>
<p>must be repleaced with:</p>
<p>“require”: {<br>
        …,<br>
        “doctrine/doctrine-orm-module”: “dev-master”<br>
}</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=7393#respond" onclick='return addComment.moveForm("comment-7393", "7393", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-7436">
	<div id="comment-7436">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/b0c8fe16ee31b8d202455d1a13b9d698.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Michelangelo</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-7436">October 11, 2012 at 1:05 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi thanks for this tutorial. There is an issue with this composer configuration:<br>
<code><br>
"doctrine/DoctrineORMModule": "dev-master"<br>
</code></p>
<p>issue:</p>
<p> – The requested package doctrine/doctrineormmodule dev-master could not be found.</p>
<p>regards</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=7436#respond" onclick='return addComment.moveForm("comment-7436", "7436", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="pingback odd alt thread-even depth-1" id="li-comment-7470">
	<div id="comment-7470">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://www.zfforum.de/zf2-db/9573-doctrine-fuer-alle.html#post73895" rel="external nofollow" class="url">Doctrine für alle?! - Zend Framework Forum - ZF1 / ZF2</a> - pingback on October 13, 2012 at 8:10 am</cite>
		</div>
	</div>
</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-7622">
	<div id="comment-7622">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/4d970505122e8d89dc6da2411a306881.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Fabyo</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-7622">October 17, 2012 at 1:34 am</a></span>
		</div>
		<div class="comment-text">
			<p>Not worked</p>
<p>Fatal error: Class ‘Zend\Mvc\Service\ServiceManagerConfiguration’ not found in </p>
<p> <img src="Using_Doctrine_2_files/icon_sad.gif" alt=":(" class="wp-smiley"> </p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=7622#respond" onclick='return addComment.moveForm("comment-7622", "7622", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="pingback odd alt thread-even depth-1" id="li-comment-7641">
	<div id="comment-7641">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://phppgsql.wordpress.com/2012/10/17/zend-framework-2-doctrine-parte-1/" rel="external nofollow" class="url">Zend Framework 2 + Doctrine – Parte 1 « PHP + PGSQL + afins</a> - pingback on October 17, 2012 at 4:25 pm</cite>
		</div>
	</div>
</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-7646">
	<div id="comment-7646">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/30e8aae6475038baad74b898d90d824c.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Brasil</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-7646">October 17, 2012 at 6:28 pm</a></span>
		</div>
		<div class="comment-text">
			<p>An error occurred<br>
An error occurred during execution; please try again later.<br>
Additional information:<br>
Doctrine\Common\Persistence\Mapping\MappingException</p>
<p>File:</p>
<p>    C:\root\zf2-tutorial\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\MappingException.php:38</p>
<p>Message:</p>
<p>    The class ‘Album\Entity\Album’ was not found in the chain configured namespaces </p>
<p>I need help<br>
thanks</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=7646#respond" onclick='return addComment.moveForm("comment-7646", "7646", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="pingback odd alt thread-even depth-1" id="li-comment-7686">
	<div id="comment-7686">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://zendbrasil.org/tutoriais/zend-framework/zend-framework-2-doctrine-parte-1/" rel="external nofollow" class="url">Zend Framework 2 + Doctrine – Parte 1</a> - pingback on October 18, 2012 at 11:39 am</cite>
		</div>
	</div>
</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-7785">
	<div id="comment-7785">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/a6cdd4820f384abb3bf327b061336187.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Celebros</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-7785">October 20, 2012 at 6:52 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Do you know anything about the CLI-tools?<br>
If i try to run, for example, “./doctrine-module orm:schema-tool:update”
 I get an exception that the driver is not found. It seems like some 
more autoloading is required…</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=7785#respond" onclick='return addComment.moveForm("comment-7785", "7785", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-7881">
	<div id="comment-7881">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/7244c7ff61d5bea6e5d1a2bae3befb77.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.houssem-zaier.comli.com/" rel="external nofollow" class="url">Houssem Zaier</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-7881">October 24, 2012 at 12:08 am</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks for this tutorial , I think its time to update it as ZF2 has changed for a lot !</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=7881#respond" onclick='return addComment.moveForm("comment-7881", "7881", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-8275">
	<div id="comment-8275">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d08c633e5424aa3bcc8b22376f4a3d85.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Bung'er</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-8275">November 1, 2012 at 6:10 am</a></span>
		</div>
		<div class="comment-text">
			<p>I followed your nice tutorial but when updating Schema i get this error:<br>
 <b>[InvalidArgumentException]<br>
  The helper “em” is not defined. </b></p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=8275#respond" onclick='return addComment.moveForm("comment-8275", "8275", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment odd alt depth-2" id="li-comment-8741">
	<div id="comment-8741">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/34a6529ead9c09a4de5e75c088d8089a.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Toni</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-8741">November 5, 2012 at 8:11 am</a></span>
		</div>
		<div class="comment-text">
			<p>Me to, did you already found a solution?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=8741#respond" onclick='return addComment.moveForm("comment-8741", "8741", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-3" id="li-comment-24521">
	<div id="comment-24521">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/88334d4c3c9979e5cbfd60e4cfe09b71.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Dmitry</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-24521">March 18, 2013 at 5:51 pm</a></span>
		</div>
		<div class="comment-text">
			<p>The CLI interface is not <code>./vendor/bin/doctrine</code>, but <code>./vendor/bin/doctrine-module</code></p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=24521#respond" onclick='return addComment.moveForm("comment-24521", "24521", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>
</ul>
</li>

<li class="pingback odd alt thread-even depth-1" id="li-comment-8639">
	<div id="comment-8639">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://shaneauckland.co.uk/2012/11/setting-up-doctrine-in-zend-framework-2-newbie-guide/" rel="external nofollow" class="url">shanethehat » Setting up Doctrine in Zend Framework 2 – Newbie guide</a> - pingback on November 4, 2012 at 2:50 pm</cite>
		</div>
	</div>
</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-8640">
	<div id="comment-8640">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/8be01531e6ea5798571bf1eb5826627f.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.shaneauckland.com/" rel="external nofollow" class="url">shanethehat</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-8640">November 4, 2012 at 2:59 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Jason, I’ve posted a blog entry using your tutorial with ZF2 
stable. It still works pretty good with a couple of minor changes. Thank
 you for the write up!<br>
<a href="http://shaneauckland.co.uk/2012/11/setting-up-doctrine-with-zend-framework-2" rel="nofollow">Setting up Doctrine with Zend Framework 2</a></p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=8640#respond" onclick='return addComment.moveForm("comment-8640", "8640", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-9010">
	<div id="comment-9010">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/97a1aefeb37ee44c925e35ff48ee48ba.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Dragos</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-9010">November 6, 2012 at 11:05 pm</a></span>
		</div>
		<div class="comment-text">
			<p>i tried with your example and receive this :</p>
<p>    – The requested package doctrine/doctrineormmodule could not be 
found in any version, there may be a typo in the package name.</p>
<p>if i install like doctrine documentaion say icannot put this: </p>
<p>    ‘DoctrineModule’,<br>
    ‘DoctrineORMModule’ receive errors.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=9010#respond" onclick='return addComment.moveForm("comment-9010", "9010", "respond", "324")'>Reply</a>		</div>
	</div>

<ul class="children">

<li class="comment even depth-2" id="li-comment-9139">
	<div id="comment-9139">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/2976e9994f0cc0cac1dac79ca8032961.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.bancadejoburi.ro/" rel="external nofollow" class="url">Atti</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-9139">November 9, 2012 at 1:38 pm</a></span>
		</div>
		<div class="comment-text">
			<p>In composer.json try “doctrine/doctrine-orm-module”: “dev-master”</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=9139#respond" onclick='return addComment.moveForm("comment-9139", "9139", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt depth-2" id="li-comment-9141">
	<div id="comment-9141">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/2976e9994f0cc0cac1dac79ca8032961.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.bancadejoburi.ro/" rel="external nofollow" class="url">Atti</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-9141">November 9, 2012 at 2:08 pm</a></span>
		</div>
		<div class="comment-text">
			<p>And also add “minimum-stability”: “dev”,</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=9141#respond" onclick='return addComment.moveForm("comment-9141", "9141", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
</ul>
</li>

<li class="pingback even thread-odd thread-alt depth-1" id="li-comment-9104">
	<div id="comment-9104">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://blogdobeto.com/ti/zend-framework-2-doctrine-parte-1/" rel="external nofollow" class="url">Zend Framework 2 + Doctrine – Parte 1 | Blog do Beto</a> - pingback on November 8, 2012 at 3:47 pm</cite>
		</div>
	</div>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-9127">
	<div id="comment-9127">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/5abcd12328708f5f4f7f347bc6e359b9.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Cor le Roux</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-9127">November 9, 2012 at 5:36 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Jason, thank you for this! It works like an absolute charm!! 
I’ve never worked with an ORM, so I am looking forward to the new 
experience.</p>
<p>I have one more favor to ask please:<br>
would you be so kind as to change your tutorial to reflect the fixes made by @shanethehat please?<br>
<a href="http://shaneauckland.co.uk/2012/11/setting-up-doctrine-with-zend-framework-2" rel="nofollow">Setting up Doctrine with Zend Framework 2</a></p>
<p>I would like to include the URL to this tutorial in the comments 
section of my Doctrine controller file and referencing 2 tutorials seems
 a bit messy.</p>
<p>I will credit you as the author and shane as a contributor if that’s ok.</p>
<p>Once again, thank you!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=9127#respond" onclick='return addComment.moveForm("comment-9127", "9127", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-9199">
	<div id="comment-9199">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/c1cbaa8ea97f3edafda6d0e13ef03653.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.1stclassite.com/" rel="external nofollow" class="url">Jonecir</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-9199">November 10, 2012 at 6:44 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I have already installed ZF2 and doctrine. Is there a way to just install the Album application?</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=9199#respond" onclick='return addComment.moveForm("comment-9199", "9199", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-9419">
	<div id="comment-9419">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/8561ead9abe4650d28d13368b8fb5b9c.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">M.R.Smit</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-9419">November 13, 2012 at 3:15 pm</a></span>
		</div>
		<div class="comment-text">
			<p>oke, i am not usually the sort of guy that posts and reacts on 
blogs. but i encounterd an error(and the fix for it) that is worth 
sharing with you all.</p>
<p>if you have a typo in your class name that mismatches with the entity
 file name. you get a fatal error saying the class has already been 
declared.</p>
<p>this message gives you false input and can give you many headaches!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=9419#respond" onclick='return addComment.moveForm("comment-9419", "9419", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="pingback even thread-odd thread-alt depth-1" id="li-comment-9427">
	<div id="comment-9427">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://blog.is4w.com.br/integrando-doctrine-2-com-zend-framework-2/" rel="external nofollow" class="url">Integrando Doctrine 2 com Zend Framework 2 | IS4W</a> - pingback on November 13, 2012 at 5:46 pm</cite>
		</div>
	</div>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-9442">
	<div id="comment-9442">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/22348910e3dcd3bab75b81063f9a7da6.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Michael</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-9442">November 13, 2012 at 10:15 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi,</p>
<p>Great Tutorial!</p>
<p>I have one question, which you may or may not have an answer to, and it might be a stupid one.</p>
<p>Given that ZF2 is modular, is there a way of using Doctrine’s CLI tool to generate the entities to their current location?<br>
When you run the CLI tool, you have to specify a destination path, but 
obviously this wont work as all entities from all modules will be dumped
 in the one directory which will cause issues when trying to access 
them.</p>
<p>Any suggestions would be great!</p>
<p>Cheers</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=9442#respond" onclick='return addComment.moveForm("comment-9442", "9442", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-9497">
	<div id="comment-9497">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/2ce8b677311252d88f3985102c743010.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">exfromtheleft</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-9497">November 14, 2012 at 12:14 pm</a></span>
		</div>
		<div class="comment-text">
			<p>followed everything described in this tutorial and i get this PHP 
Fatal error:  Uncaught exception 
‘Zend\Loader\Exception\InvalidArgumentException’ with message 
‘Autoloader class “doctrine” not loaded’ in 
S:\zendserver\Apache2\htdocs\pgep-moteur-synchro\vendor\zendframework\zendframework\library\Zend\Loader\AutoloaderFactory.php:92</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=9497#respond" onclick='return addComment.moveForm("comment-9497", "9497", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-10090">
	<div id="comment-10090">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/1236bc202209ebdcb5d0f92d78ec9f32.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Marco Patiño</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-10090">November 24, 2012 at 4:28 am</a></span>
		</div>
		<div class="comment-text">
			<p>In case that anyone is having problem with running the unit 
testing from the original example you need to include the 
DoctrineModule’ and ‘DoctrineORMModule’ to your modules array in your 
TestConfig.php file or you will get a constant error when running 
phpunit: Zend\ServiceManager\Exception\ServiceNotFoundException: 
Zend\ServiceManager\ServiceManager::get was unable to fetch or create an
 instance for doctrine.entitymanager.orm_default</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=10090#respond" onclick='return addComment.moveForm("comment-10090", "10090", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-10181">
	<div id="comment-10181">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/25340ef2d7de62f2cff4481220c535ae.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Zak</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-10181">November 25, 2012 at 9:40 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Use : “doctrine/doctrine-orm-module”: “dev-master”</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=10181#respond" onclick='return addComment.moveForm("comment-10181", "10181", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-11626">
	<div id="comment-11626">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/64ea4f1de5abb7c7313263eb6dec8f9e.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://urwebsite.blogspot.in/" rel="external nofollow" class="url">sunel</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-11626">December 13, 2012 at 8:44 am</a></span>
		</div>
		<div class="comment-text">
			<p>i came with issue googled but no use please help me</p>
<p>Warning: class_parents(): Class User\Entity\User does not exist and 
could not be loaded in 
D:\xampp\htdocs\Sitezar\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\RuntimeReflectionService.php
 on line 40</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=11626#respond" onclick='return addComment.moveForm("comment-11626", "11626", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="pingback even thread-odd thread-alt depth-1" id="li-comment-12097">
	<div id="comment-12097">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://www.zfforum.de/zf2-db/11841-zf2-doctrine-form-bind-aenderungen-datenbank-speichern.html#post76877" rel="external nofollow" class="url">ZF2 Doctrine Form bind änderungen in Datenbank speichern. - Zend Framework Forum - ZF1 / ZF2</a> - pingback on December 18, 2012 at 10:01 am</cite>
		</div>
	</div>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-12768">
	<div id="comment-12768">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/bde499c3f495796b86a353617ce40755.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.undo-studio.com/" rel="external nofollow" class="url">Alí Suárez</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-12768">December 27, 2012 at 6:36 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hi.</p>
<p>I’m getting an Error 500.</p>
<p>This is what my log shows:</p>
<p>[Thu Dec 27 02:23:43 2012] [error] [client 127.0.0.1] PHP Fatal 
error:  Uncaught exception 
‘Zend\\ServiceManager\\Exception\\ServiceNotFoundException’ with message
 ‘Zend\\ServiceManager\\ServiceManager::get was unable to fetch or 
create an instance for translator’ in 
/Library/WebServer/Documents/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:452\nStack
 trace:\n#0 
/Library/WebServer/Documents/zf2-tutorial/module/Application/Module.php(19):
 Zend\\ServiceManager\\ServiceManager-&gt;get(‘translator’)\n#1 
[internal function]: 
Application\\Module-&gt;onBootstrap(Object(Zend\\Mvc\\MvcEvent))\n#2 
/Library/WebServer/Documents/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(464):
 call_user_func(Array, Object(Zend\\Mvc\\MvcEvent))\n#3 
/Library/WebServer/Documents/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(208):
 Zend\\EventManager\\EventManager-&gt;triggerListeners(‘bootstrap’, 
Object(Zend\\Mvc\\MvcEvent), Array)\n#4 
/Library/WebServer/Documents/zf2-tutorial/vendor/zendframework/zendfr in
 
/Library/WebServer/Documents/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php
 on line 452</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=12768#respond" onclick='return addComment.moveForm("comment-12768", "12768", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-13477">
	<div id="comment-13477">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/d005d8030dee36d2e88671e127900a2d.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://zftutorial.localhost/" rel="external nofollow" class="url">Arpita Rana</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-13477">January 7, 2013 at 9:41 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hi when I use php composer.phar after added one line 
“doctrine/DoctrineORMModule”: “dev-master” in composer.json that time i 
getting following issue so help me</p>
<p>D:\ZendSkeletonApplication&gt;php composer.phar update<br>
Loading composer repositories with package information<br>
Updating dependencies<br>
Your requirements could not be resolved to an installable set of packages.</p>
<p>  Problem 1<br>
    – The requested package doctrine/doctrineormmodule could not be found in any<br>
 version, there may be a typo in the package name.</p>
<p>Potential causes:<br>
 – A typo in the package name<br>
 – The package is not available in a stable-enough version according to your min<br>
imum-stability setting<br>
   see  f<br>
or more details.</p>
<p>Read  for further common<br>
 problems.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=13477#respond" onclick='return addComment.moveForm("comment-13477", "13477", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-14571">
	<div id="comment-14571">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/3cf7a8ab0bccee5b65d39b50a170a555.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://marco-pivetta.com/" rel="external nofollow" class="url">Marco Pivetta</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-14571">January 24, 2013 at 1:52 pm</a></span>
		</div>
		<div class="comment-text">
			<p>@Jason can you PLEASE add a disclaimer at the top of this article about its deprecation? PLEASE!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=14571#respond" onclick='return addComment.moveForm("comment-14571", "14571", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-14630">
	<div id="comment-14630">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/79ea8a3e8e37391baea47162b78a521c.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">devta</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-14630">January 25, 2013 at 11:35 am</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Guys,</p>
<p>Thanks for such a great tutorial. It was a life saver for me. I have 
one question regarding the doctrine entity models. Instead of storing 
the model files into each module’s Entity folder, is it possible to 
store all entity model files into a single location. what do we need to 
change in our module.config.php to make this happen. </p>
<p>Your help will be greatly appreciated mate. Cheers.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=14630#respond" onclick='return addComment.moveForm("comment-14630", "14630", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-15299">
	<div id="comment-15299">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/553cc19ca425a6753dba50be71393c99.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://rapvokzal.com/" rel="external nofollow" class="url">Ruslan</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-15299">January 28, 2013 at 6:06 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I tried to bridge the <a href="https://github.com/akrabat/zf2-tutorial" rel="nofollow">https://github.com/akrabat/zf2-tutorial</a> with this article, but failed.</p>
<p>Plan to update this article?<br>
Sorry for the simple questions. I just started to learn Zend.</p>
<p>My respect and thanks a lot.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=15299#respond" onclick='return addComment.moveForm("comment-15299", "15299", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-15301">
	<div id="comment-15301">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/e0b1d950b98cf5acabd78ad981ae84a2.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">war10ck</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-15301">January 28, 2013 at 6:14 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi Jason, this is my question how do i use doctrine2 with zf2 with
 multiple database connections? i already tried adding entries to the 
connection section y config/autoload/global.php the true problem seems 
how do i tell to the entity manager wich connection use at anytime.<br>
i really apreciate a swift response. Thnx ^_^</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=15301#respond" onclick='return addComment.moveForm("comment-15301", "15301", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-16026">
	<div id="comment-16026">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/ccfd1ca17cb6bc8221c244fab1d8f3f3.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Euler Nuñez</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-16026">January 31, 2013 at 3:31 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Great tutorial!! thx</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=16026#respond" onclick='return addComment.moveForm("comment-16026", "16026", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-17631">
	<div id="comment-17631">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/1b1b9b55746e75598a9229fb854f99d6.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">NASTRON</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-17631">February 7, 2013 at 5:13 pm</a></span>
		</div>
		<div class="comment-text">
			<p>__get() property body should be exactly as follows:</p>
<p>public function __get($property) {<br>
        if(property_exists($this, $property)) {<br>
            return $this-&gt;$property;<br>
        }<br>
    }</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=17631#respond" onclick='return addComment.moveForm("comment-17631", "17631", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-18570">
	<div id="comment-18570">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/e99a29e28a086e4860f48f94e0fcf4d4.jpeg" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://www.andrew-kirkpatrick.com/" rel="external nofollow" class="url">Andrew Kirkpatrick</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-18570">February 11, 2013 at 10:29 pm</a></span>
		</div>
		<div class="comment-text">
			<p>An excellent tutorial! Got my code switched over almost straight away</p>
<p>I had an issue installing initially via Composer, and had to change the composer.json to the following:</p>
<p>“doctrine/orm”: “*”,<br>
 “doctrine/doctrine-orm-module”: “*”</p>
<p>Using the package listed at the top, or trying to change these to 
dev-master, results in “Your requirements could not be resolved to an 
installable set of packages.”</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=18570#respond" onclick='return addComment.moveForm("comment-18570", "18570", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="pingback even thread-odd thread-alt depth-1" id="li-comment-20008">
	<div id="comment-20008">
		<div class="comment-author vcard pingback">
			<cite class="fn zbench_pingback"><a href="http://www.andrew-kirkpatrick.com/2013/02/the-class-x-was-not-found-in-the-chain-configured-namespaces/" rel="external nofollow" class="url">Zend Framework 2 and Doctrine 2 namespace chain error, class not found</a> - pingback on February 20, 2013 at 8:37 pm</cite>
		</div>
	</div>
</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-21514">
	<div id="comment-21514">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/fe41d14c6af523c6f91e9b01200afce7.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Sandeep</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-21514">March 1, 2013 at 2:01 pm</a></span>
		</div>
		<div class="comment-text">
			<p>Hi,</p>
<p>I seriously need help.  Just need addaction code for zend 2.1.4 dev.  </p>
<p>I have corrected the code for delete but i cant correct for addAction</p>
<p>Fatal error: Call to undefined method Album\Model\Album::populate() in \module\Album\src\Album\Controller\AlbumController.php</p>
<p>I know i need object of album entity  and i am not getting it to use populate method.</p>
<p>Please help i am in urgent need</p>
<p>Thanks!!</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=21514#respond" onclick='return addComment.moveForm("comment-21514", "21514", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-23042">
	<div id="comment-23042">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/799ff0ef8928e5909811034a93ce90d1.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://rds.net.in/" rel="external nofollow" class="url">Rahul Prasad</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-23042">March 10, 2013 at 1:11 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I think<br>
“require”: {<br>
        …,<br>
        “doctrine/DoctrineORMModule”: “dev-master”<br>
},</p>
<p>is wrong it should be<br>
“require”: {<br>
        …,<br>
        “doctrine/doctrine-orm-module”: “dev-master”<br>
},</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=23042#respond" onclick='return addComment.moveForm("comment-23042", "23042", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-23241">
	<div id="comment-23241">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/799ff0ef8928e5909811034a93ce90d1.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn"><a href="http://rds.net.in/" rel="external nofollow" class="url">Rahul Prasad</a></cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-23241">March 11, 2013 at 5:31 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I am getting this message.</p>
<p>Deprecated: Polyfill autoload support (file 
library/Zend/Stdlib/compatibility/autoload.php) is no longer necessary; 
please remove your require statement referencing this file in 
/var/www/rahul/learning/zend4/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/Stdlib/compatibility/autoload.php
 on line 14</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=23241#respond" onclick='return addComment.moveForm("comment-23241", "23241", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment even thread-odd thread-alt depth-1" id="li-comment-28267">
	<div id="comment-28267">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/a7f4dc95d6b4e9975aa669ee1a403b0b.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">Pizzy</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-28267">March 31, 2013 at 5:54 pm</a></span>
		</div>
		<div class="comment-text">
			<p>I quite appreciate your work. Straight and Simple.<br>
Is it possible to work with Doctrine CLI from the bin directory???<br>
I tried it but I got some errors.<br>
Perhaps there’s something very simple I could do to correct it.<br>
It just says something like:<br>
[InvalidArgumentException]<br>
The helper “em” is not defined. </p>
<p>I don’t want to mess with the configuration till I’m sure I know what I’m doing. It is an important project.</p>
<p>Thanks in advance for any help.</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=28267#respond" onclick='return addComment.moveForm("comment-28267", "28267", "respond", "324")'>Reply</a>		</div>
	</div>

</li>

<li class="comment odd alt thread-even depth-1" id="li-comment-29705">
	<div id="comment-29705">
		<div class="comment-author vcard">
			<img alt="" src="Using_Doctrine_2_files/4ac680400da99a33712594a29ac90997.png" class="avatar avatar-40 photo" height="40" width="40">			<cite class="fn">pAwAn</cite>
			<span class="comment-meta commentmetadata"><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#comment-29705">April 4, 2013 at 8:18 am</a></span>
		</div>
		<div class="comment-text">
			<p>Thanks a lot for this.. <img src="Using_Doctrine_2_files/icon_smile.gif" alt=":)" class="wp-smiley"><br>
very well explained.. keep posting stuff in such a good way..</p>
					</div>
		<div class="reply">
			<a class="comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/?replytocom=29705#respond" onclick='return addComment.moveForm("comment-29705", "29705", "respond", "324")'>Reply</a>		</div>
	</div>

</li>
		</ol>
		<div class="navigation"></div>
									<div id="respond">
				<h3 id="reply-title">Leave a Comment <small><a rel="nofollow" id="cancel-comment-reply-link" href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#respond" style="display:none;"><small>Cancel reply</small></a></small></h3>
									<form action="http://www.jasongrimes.org/wp-comments-post.php" method="post" id="commentform">
																										<p class="comment-form-author"><input id="author" name="author" size="30" type="text"> <label for="author"><small>NAME</small></label></p>
<p class="comment-form-email"><input id="email" name="email" size="30" type="text"> <label for="email">EMAIL</label></p>
<p class="comment-form-url"><input id="url" name="url" size="30" type="text"> <label for="url">Website URL</label></p>
												<p class="comment-form-comment"><textarea aria-required="true" rows="8" cols="45" name="comment" id="comment" onkeydown="if(event.ctrlKey){if(event.keyCode==13){document.getElementById('submit').click();return false}};"></textarea></p>						<p class="comment-note">NOTE - You can use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:<br> <code>&lt;a
 href="" title=""&gt; &lt;abbr title=""&gt; &lt;acronym title=""&gt; 
&lt;b&gt; &lt;blockquote cite=""&gt; &lt;cite&gt; &lt;code&gt; &lt;del 
datetime=""&gt; &lt;em&gt; &lt;i&gt; &lt;q cite=""&gt; &lt;strike&gt; 
&lt;strong&gt; </code></p>						<p class="form-submit">
							<input name="submit" id="submit" value="SUBMIT" type="submit">
							<input name="comment_post_ID" value="324" id="comment_post_ID" type="hidden">
<input name="comment_parent" id="comment_parent" value="0" type="hidden">
						</p>
						<p style="display: none;"><input id="akismet_comment_nonce" name="akismet_comment_nonce" value="fc1bab553b" type="hidden"></p>					</form>
							</div><!-- #respond -->
								<div class="trackbacks-pingbacks">
			<h3>Trackbacks and Pingbacks:</h3>
			<ul id="pinglist">
				    <li id="comment-716">
        <a href="http://links.davidesalerno.net/2012/01/using-doctrine-2-in-zend-framework-2-the-blog-of-jason-grimes/" rel="external nofollow" class="url">Using Doctrine 2 in Zend Framework 2 | The Blog of Jason Grimes | Links di Davide Salerno</a> - Pingback on 2012/01/31/ 12:38</li>
    <li id="comment-970">
        <a href="http://codeperl.wordpress.com/2012/02/25/doctrine-and-zend-framework-integration/" rel="external nofollow" class="url">Doctrine and Zend Framework integration « Codeperl's Knowledge Sharing System</a> - Pingback on 2012/02/25/ 06:36</li>
    <li id="comment-985">
        <a href="http://zfuniversity.com/2012/01/31/jason-grimes-using-doctrine-2-in-zend-framework-2/" rel="external nofollow" class="url">Jason Grimes: Using Doctrine 2 in Zend Framework 2 | Zend Framework University</a> - Pingback on 2012/02/27/ 03:27</li>
    <li id="comment-2603">
        <a href="http://blog.redphoenixsoftware.com/?p=15" rel="external nofollow" class="url">Configuring an AWS Linux Instance to run PHP and MongoDB and Apache</a> - Pingback on 2012/05/11/ 13:44</li>
    <li id="comment-5715">
        <a href="http://blog.redphoenixsoftware.com/zf2-beta-4-with-mongodb-installation/" rel="external nofollow" class="url">ZF2 Beta 4, MongoDB, and Doctrine installation - RPS</a> - Pingback on 2012/08/15/ 23:55</li>
    <li id="comment-6737">
        <a href="http://jisku.com/blog/2012/09/use-of-doctrine-2-in-zend-framework-2/" rel="external nofollow" class="url">Use of Doctrine 2 in Zend Framework 2 | Jisku.com - Developers Network</a> - Pingback on 2012/09/13/ 13:31</li>
    <li id="comment-6856">
        <a href="http://jisku.com/blog/2012/09/how-to-use-memcached-in-doctrine2-zf2/" rel="external nofollow" class="url">How to use Memcached in Doctrine2 / ZF2? | Jisku.com - Developers Network</a> - Pingback on 2012/09/17/ 16:12</li>
    <li id="comment-7470">
        <a href="http://www.zfforum.de/zf2-db/9573-doctrine-fuer-alle.html#post73895" rel="external nofollow" class="url">Doctrine für alle?! - Zend Framework Forum - ZF1 / ZF2</a> - Pingback on 2012/10/13/ 08:10</li>
    <li id="comment-7641">
        <a href="http://phppgsql.wordpress.com/2012/10/17/zend-framework-2-doctrine-parte-1/" rel="external nofollow" class="url">Zend Framework 2 + Doctrine – Parte 1 « PHP + PGSQL + afins</a> - Pingback on 2012/10/17/ 16:25</li>
    <li id="comment-7686">
        <a href="http://zendbrasil.org/tutoriais/zend-framework/zend-framework-2-doctrine-parte-1/" rel="external nofollow" class="url">Zend Framework 2 + Doctrine – Parte 1</a> - Pingback on 2012/10/18/ 11:39</li>
    <li id="comment-8639">
        <a href="http://shaneauckland.co.uk/2012/11/setting-up-doctrine-in-zend-framework-2-newbie-guide/" rel="external nofollow" class="url">shanethehat » Setting up Doctrine in Zend Framework 2 – Newbie guide</a> - Pingback on 2012/11/04/ 14:50</li>
    <li id="comment-9104">
        <a href="http://blogdobeto.com/ti/zend-framework-2-doctrine-parte-1/" rel="external nofollow" class="url">Zend Framework 2 + Doctrine – Parte 1 | Blog do Beto</a> - Pingback on 2012/11/08/ 15:47</li>
    <li id="comment-9427">
        <a href="http://blog.is4w.com.br/integrando-doctrine-2-com-zend-framework-2/" rel="external nofollow" class="url">Integrando Doctrine 2 com Zend Framework 2 | IS4W</a> - Pingback on 2012/11/13/ 17:46</li>
    <li id="comment-12097">
        <a href="http://www.zfforum.de/zf2-db/11841-zf2-doctrine-form-bind-aenderungen-datenbank-speichern.html#post76877" rel="external nofollow" class="url">ZF2 Doctrine Form bind änderungen in Datenbank speichern. - Zend Framework Forum - ZF1 / ZF2</a> - Pingback on 2012/12/18/ 10:01</li>
    <li id="comment-20008">
        <a href="http://www.andrew-kirkpatrick.com/2013/02/the-class-x-was-not-found-in-the-chain-configured-namespaces/" rel="external nofollow" class="url">Zend Framework 2 and Doctrine 2 namespace chain error, class not found</a> - Pingback on 2013/02/20/ 20:37</li>
			</ul>
		</div>
	</div><!--content-->
<div id="sidebar-border">
	<div id="rss_border">
		<div class="rss_border">
			<div id="rss_wrap">
				<div class="rss_wrap">
										<a class="rss rss_text" href="http://www.jasongrimes.org/feed/" rel="bookmark" title="RSS Feed">RSS Feed</a>
																													</div>
			</div>
		</div>
	</div>
	<div id="sidebar">

<div id="categories-3" class="widget widget_categories"><h3 class="widgettitle">Topics</h3>		<ul>
	<li class="cat-item cat-item-15"><a href="http://www.jasongrimes.org/category/business/" title="View all posts filed under Business">Business</a>
</li>
	<li class="cat-item cat-item-18"><a href="http://www.jasongrimes.org/category/kids/" title="View all posts filed under Kids">Kids</a>
</li>
	<li class="cat-item cat-item-8"><a href="http://www.jasongrimes.org/category/development/" title="View all posts filed under Software Development">Software Development</a>
</li>
	<li class="cat-item cat-item-4"><a href="http://www.jasongrimes.org/category/systems-administration/" title="View all posts filed under Systems Administration">Systems Administration</a>
</li>
		</ul>
</div>		<div id="recent-posts-2" class="widget widget_recent_entries">		<h3 class="widgettitle">Recent Posts</h3>		<ul>
				<li><a href="http://www.jasongrimes.org/2012/06/deploying-a-lamp-application-with-chef-vagrant-and-ec2-3-of-3/" title="Deploying a LAMP application with Chef, Vagrant, and EC2 (3 of 3)">Deploying a LAMP application with Chef, Vagrant, and EC2 (3 of 3)</a></li>
				<li><a href="http://www.jasongrimes.org/2012/06/provisioning-a-lamp-stack-with-chef-vagrant-and-ec2-2-of-3/" title="Provisioning a LAMP stack with Chef, Vagrant, and EC2 (2 of 3)">Provisioning a LAMP stack with Chef, Vagrant, and EC2 (2 of 3)</a></li>
				<li><a href="http://www.jasongrimes.org/2012/06/managing-lamp-environments-with-chef-vagrant-and-ec2-1-of-3/" title="Managing LAMP environments with Chef, Vagrant, and EC2 (1 of 3)">Managing LAMP environments with Chef, Vagrant, and EC2 (1 of 3)</a></li>
				<li><a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/" title="Using Doctrine 2 in Zend Framework 2">Using Doctrine 2 in Zend Framework 2</a></li>
				<li><a href="http://www.jasongrimes.org/2012/01/using-apache-ivy-to-manage-directory-dependencies-in-non-java-projects/" title="Using Apache Ivy to manage directory dependencies in non-Java projects">Using Apache Ivy to manage directory dependencies in non-Java projects</a></li>
				<li><a href="http://www.jasongrimes.org/2011/09/my-five-year-olds-top-5-ipad-apps/" title="My kindergartener’s top 5 iPad apps">My kindergartener’s top 5 iPad apps</a></li>
				<li><a href="http://www.jasongrimes.org/2011/09/trying-out-free-pingdom-monitoring-service/" title="Trying out the free Pingdom monitoring service">Trying out the free Pingdom monitoring service</a></li>
				<li><a href="http://www.jasongrimes.org/2011/07/if-its-not-hell-yeah-consider-it-no/" title="If it’s not “HELL YEAH”, consider it “no”">If it’s not “HELL YEAH”, consider it “no”</a></li>
				<li><a href="http://www.jasongrimes.org/2011/07/using-a-custom-collection-class-with-zend_paginator/" title="Using a custom collection class with Zend_Paginator">Using a custom collection class with Zend_Paginator</a></li>
				<li><a href="http://www.jasongrimes.org/2011/07/automatically-announce-subversion-commits-on-yammer-with-svn2yammer/" title="Automatically announce Subversion commits on Yammer with svn2yammer">Automatically announce Subversion commits on Yammer with svn2yammer</a></li>
				</ul>
		</div>
<style type="text/css">
/*
	This is a basic set of rules designed to work well with
	the Twenty Ten theme provided as part of WordPress 3.0.
*/
#main .widget-area ul.hl_recent_tweets {
	clear: both;
	list-style: none;
	margin: 0;
	padding: 6px 0 0;
}

.hl_recent_tweets li {
		margin-bottom: 6px;
}
.hl_recent_tweets p {
	margin-bottom: 0;
}
.hl_recent_tweets span {
	display: block;
	font-size: 10px;
}
.hl_recent_tweets_none {
	margin-bottom: 0;
}
.hl_recent_tweets_meta {
	font-size: 10px;
	color: #999;
	font-style: italic;
}
</style>

<div id="hl_twitter_widget-3" class="widget widget_hl_twitter_widget">
<h3 class="widgettitle">	Recent Tweets</h3>
	<ul class="hl_recent_tweets">
					<li>
				<p>
					RT <a href="http://twitter.com/1_wave">@1_wave</a>: .<a href="http://twitter.com/sivers">@sivers</a> "You can't wait for inspiration, you have to go after it with a club." -jack london					<span class="meta">
						<a href="http://twitter.com/jason_grimes/status/324212607470927873">
							11 hours ago
						</a>
					</span>
				</p>
			</li>
					<li>
				<p>
					RT <a href="http://twitter.com/SciencePorn">@SciencePorn</a>: <a href="http://t.co/Smxu5FLBKi">http://t.co/Smxu5FLBKi</a>					<span class="meta">
						<a href="http://twitter.com/jason_grimes/status/322876220784123904">
							4 days ago
						</a>
					</span>
				</p>
			</li>
					<li>
				<p>
					The entrance/non-entrance door at my local Target. <a href="http://t.co/nhoCvJWZXk">http://t.co/nhoCvJWZXk</a>					<span class="meta">
						<a href="http://twitter.com/jason_grimes/status/321005785293398017">
							1 week ago
						</a>
					</span>
				</p>
			</li>
					<li>
				<p>
					RT <a href="http://twitter.com/AlCastle">@AlCastle</a>: Wat. This is hilarious. <a href="http://search.twitter.com/search?q=Ruby">#Ruby</a> <a href="http://search.twitter.com/search?q=Javascript">#Javascript</a> 

<a href="http://t.co/n89iF1tNIb">http://t.co/n89iF1tNIb</a>  /via <a href="http://twitter.com/garybernhardt">@garybernhardt</a>					<span class="meta">
						<a href="http://twitter.com/jason_grimes/status/321003491764097024">
							1 week ago
						</a>
					</span>
				</p>
			</li>
					<li>
				<p>
					Before I became a parent I would never have believed so much of my 
life would be dedicated to the handling of human excrement. <a href="http://search.twitter.com/search?q=fb">#fb</a>					<span class="meta">
						<a href="http://twitter.com/jason_grimes/status/320905282265960448">
							1 week ago
						</a>
					</span>
				</p>
			</li>
			</ul>



</div><div id="text-4" class="widget widget_text"><h3 class="widgettitle">Social</h3>			<div class="textwidget"><a href="http://twitter.com/#%21/jason_grimes" title="Twitter"><img src="Using_Doctrine_2_files/twitter_32.png" border="0" height="32" width="32"></a>

<a href="http://www.facebook.com/jasonkgrimes" title="Facebook"><img src="Using_Doctrine_2_files/facebook_32.png" border="0" height="32" width="32"></a>

<a href="https://plus.google.com/107383798598004830255" title="Google+"><img src="Using_Doctrine_2_files/g-plus-icon-32x32.png" border="0" height="32" width="32"></a>

<a href="http://www.linkedin.com/profile/view?id=34898068" title="LinkedIn"><img src="Using_Doctrine_2_files/linkedin_32.png" border="0" height="32" width="32"></a>

<a href="https://github.com/jasongrimes" title="Github: social coding"><img src="Using_Doctrine_2_files/github_32.png" border="0" height="32" width="32"></a>

<a href="http://www.flickr.com/photos/grimes/" title="Flickr"><img src="Using_Doctrine_2_files/flickr_32.png" border="0" height="32" width="32"></a>

<a href="http://mojolive.com/profile/jasongrimes" title="Mojo Live profile"><img src="Using_Doctrine_2_files/mojolive-32x32.png" border="0" height="32" width="32"></a>
</div>
		</div><div id="meta-2" class="widget widget_meta"><h3 class="widgettitle">Meta</h3>			<ul>
						<li><a href="http://www.jasongrimes.org/wp-login.php">Log in</a></li>
			<li><a href="http://www.jasongrimes.org/feed/" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li>
			<li><a href="http://www.jasongrimes.org/comments/feed/" title="The latest comments to all posts in RSS">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li>
			<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress.org</a></li>
						</ul>
</div>

	</div><!-- end: #sidebar -->
</div><!-- end: #sidebar-border --></div><!--wrapper-->
<div class="clear"></div>
<div id="footer">
	<div id="footer-inside">
		<p>
			Copyright © 2013 The Blog of Jason Grimes			| Powered by <a href="http://wordpress.org/">WordPress</a> and <a href="http://zww.me/">zBench</a>
		</p>
		<span id="back-to-top">↑ <a href="#" rel="nofollow" title="Back to top">Top</a></span>
	</div>
</div><!--footer-->
	<!-- Start of StatCounter Code -->
	<script type="text/javascript">
	<!-- 
		var sc_project=7296774; 
		var sc_security="936ba944"; 
		var sc_invisible=1;
	//-->
	</script>
	<script type="text/javascript" src="Using_Doctrine_2_files/counter_xhtml.js"></script>
<noscript><div class="statcounter"><a title="web analytics" href="http://statcounter.com/"><img class="statcounter" src="http://c.statcounter.com/7296774/0/936ba944/1/" alt="web analytics" /></a></div></noscript>	
	<!-- End of StatCounter Code -->
<script type="text/javascript" src="Using_Doctrine_2_files/shCore.js"></script>
<script type="text/javascript" src="Using_Doctrine_2_files/shBrushPhp.js"></script>
<script type="text/javascript">
	(function(){
		var corecss = document.createElement('link');
		var themecss = document.createElement('link');
		var corecssurl = "http://www.jasongrimes.org/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shCore.css?ver=3.0.83c";
		if ( corecss.setAttribute ) {
				corecss.setAttribute( "rel", "stylesheet" );
				corecss.setAttribute( "type", "text/css" );
				corecss.setAttribute( "href", corecssurl );
		} else {
				corecss.rel = "stylesheet";
				corecss.href = corecssurl;
		}
		document.getElementsByTagName("head")[0].insertBefore( corecss, document.getElementById("syntaxhighlighteranchor") );
		var themecssurl = "http://www.jasongrimes.org/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shThemeDefault.css?ver=3.0.83c";
		if ( themecss.setAttribute ) {
				themecss.setAttribute( "rel", "stylesheet" );
				themecss.setAttribute( "type", "text/css" );
				themecss.setAttribute( "href", themecssurl );
		} else {
				themecss.rel = "stylesheet";
				themecss.href = themecssurl;
		}
		//document.getElementById("syntaxhighlighteranchor").appendChild(themecss);
		document.getElementsByTagName("head")[0].insertBefore( themecss, document.getElementById("syntaxhighlighteranchor") );
	})();
	SyntaxHighlighter.config.strings.expandSource = '+ expand source';
	SyntaxHighlighter.config.strings.help = '?';
	SyntaxHighlighter.config.strings.alert = 'SyntaxHighlighter\n\n';
	SyntaxHighlighter.config.strings.noBrush = 'Can\'t find brush for: ';
	SyntaxHighlighter.config.strings.brushNotHtmlScript = 'Brush wasn\'t configured for html-script option: ';
	SyntaxHighlighter.defaults['pad-line-numbers'] = false;
	SyntaxHighlighter.defaults['toolbar'] = false;
	SyntaxHighlighter.defaults['wrap-lines'] = false;
	SyntaxHighlighter.all();
</script>
<script type="text/javascript" src="Using_Doctrine_2_files/jquery.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
var thickboxL10n = {"next":"Next >","prev":"< Prev","image":"Image","of":"of","close":"Close","noiframes":"This feature requires inline frames. You have iframes disabled or your browser does not support them.","loadingAnimation":"http:\/\/www.jasongrimes.org\/wp-includes\/js\/thickbox\/loadingAnimation.gif","closeImage":"http:\/\/www.jasongrimes.org\/wp-includes\/js\/thickbox\/tb-close.png"};
/* ]]> */
</script>
<script type="text/javascript" src="Using_Doctrine_2_files/thickbox.js"></script>
<script type="text/javascript" src="Using_Doctrine_2_files/galleria.js"></script>
<script type="text/javascript" src="Using_Doctrine_2_files/slickr-flickr.js"></script>
<script type="text/javascript">
jQuery.noConflict(); jQuery(document).ready(function() {
slickr_flickr_start();
});
</script>




</body></html>
<!-- Dynamic page generated in 0.483 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2013-04-17 04:56:17 -->